What does the shipping_alias column do / its intended purpose?
- brainforge
-
Topic Author
- Offline
Less
More
1 year 8 months ago #365151
by brainforge
-- HikaShop version -- : 5.1.2
-- Joomla version -- : 5.2.2
-- PHP version -- : 8.2
Nothing from what I can see.
I'm thinking of using it to implement a parent/child shipping setup.
Could that potentially create problems?
Only the child shipping_id passed to the order so no extra complications there.
The idea so far is to setup aliases like this...
parent
parent-child1
parent-child2
parent-child3
The child methods only appear when the customer selects the parent.
Could use a template view override to implement but have an existing plugin which can handle the display.
Shipping method restrictions can be applied, separately, to parent and child methods in the usual way.
-- Joomla version -- : 5.2.2
-- PHP version -- : 8.2
Nothing from what I can see.
I'm thinking of using it to implement a parent/child shipping setup.
Could that potentially create problems?
Only the child shipping_id passed to the order so no extra complications there.
The idea so far is to setup aliases like this...
parent
parent-child1
parent-child2
parent-child3
The child methods only appear when the customer selects the parent.
Could use a template view override to implement but have an existing plugin which can handle the display.
Shipping method restrictions can be applied, separately, to parent and child methods in the usual way.
Please Log in or Create an account to join the conversation.
1 year 8 months ago #365154
by nicolas
Replied by nicolas on topic What does the shipping_alias column do / its intended purpose?
Hi,
Indeed, this column is not used at the moment. However, the plan is to use it to allow the merchant to provide another name for a shipping method so that the alias can be used on the shipping methods listing, in order to know which method is for what purpose, and the main name can be used everywhere else.
So I would discourage using this column.
I would rather recommend adding a new column to the hikashop_shipping table.
That's what we do in many plugins when we need to add extra information to tables, specific to a plugin in particular.
For example, in the "reminder" plugin we have this code:
so that the plugin can add a column to the hikashop_cart table and a column to the hikashop_order table.
What's great with this is that it also supports the "check database" button of the HikaShop configuration.
Indeed, this column is not used at the moment. However, the plan is to use it to allow the merchant to provide another name for a shipping method so that the alias can be used on the shipping methods listing, in order to know which method is for what purpose, and the main name can be used everywhere else.
So I would discourage using this column.
I would rather recommend adding a new column to the hikashop_shipping table.
That's what we do in many plugins when we need to add extra information to tables, specific to a plugin in particular.
For example, in the "reminder" plugin we have this code:
Code:
public function __construct( $config = array() ) {
parent::__construct($config);
$this->db = JFactory::getDBO();
// extra code
}
// to be called during the installation process, or the first time the plugin is being used
private function initDB() {
$this->addColumn('cart', 'cart_reminded', '`cart_reminded` tinyint(4) NOT NULL DEFAULT \'0\'');
$this->addColumn('order', 'order_reminded', '`order_reminded` tinyint(4) NOT NULL DEFAULT \'0\'');
// extra code
}
private function addColumn($table, $column, $type) {
$tablename = '#__hikashop_'.$table;
if(!HIKASHOP_J30) {
$columnsTable = $this->db->getTableFields($tablename);
$columns = reset($columnsTable);
} else {
$columns = $this->db->getTableColumns($tablename);
}
if(!isset($columns[$column])) {
$databaseHelper = hikashop_get('helper.database');
$databaseHelper->addColumns($table, $type);
}
}
public function onHikashopBeforeCheckDB(&$createTable, &$custom_fields, &$structure, &$helper) {
$structure['#__hikashop_cart']['cart_reminded'] = '`cart_reminded` tinyint(4) NOT NULL DEFAULT \'0\'';
$structure['#__hikashop_order']['order_reminded'] = '`order_reminded` tinyint(4) NOT NULL DEFAULT \'0\'';
}
What's great with this is that it also supports the "check database" button of the HikaShop configuration.
Please Log in or Create an account to join the conversation.
- brainforge
-
Topic Author
- Offline
1 year 8 months ago #365304
by brainforge
Replied by brainforge on topic What does the shipping_alias column do / its intended purpose?
Thanks.
Please Log in or Create an account to join the conversation.
Time to create page: 0.173 seconds