Skip to main content

Double aliasses

More
10 years 5 months ago #235428 by Digiwacht
Double aliasses was created by Digiwacht
-- HikaShop version -- : 2.6.2
-- Joomla version -- : 3.5.1

I noticed that products can have the same name and (automatic) aliasses. The link to the products always refer to the first product with that alias. Is it possible to implement a warning when an alias already excist?

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #235449 by nicolas
Replied by nicolas on topic Double aliasses
Hi,

Add the code:
Code:
if(!empty($product->product_alias)){ $query = 'SELECT product_id FROM '.hikashop_table('product').' WHERE product_alias='.$this->db->Quote($product->product_alias); $this->db->setQuery($query); $product_with_same_alias = $this->db->loadResult(); if($product_with_same_alias && (empty($product->product_id) || $product_with_same_alias!=$product->product_id)){ $app->enqueueMessage(JText::_( 'ELEMENT_WITH_SAME_ALIAS_ALREADY_EXISTS' ), 'error'); JRequest::setVar( 'fail', $product ); return false; } }
after the code:
Code:
if($config->get('alias_auto_fill', 1) && empty($product->product_alias) && !empty($product->product_name)) { $this->addAlias($product); // add a letter at the beginning of the alias to avoid issues when the alias of a product starts with a number if($config->get('sef_remove_id', 0) && (int)$product->alias > 0) $product->alias = $config->get('alias_prefix', 'p') . $product->alias; $product->product_alias = $product->alias; unset($product->alias); }
in the file administrator/components/com_hikashop/classes/product.php and that will do it.
The following user(s) said Thank You: trevsmiff

Please Log in or Create an account to join the conversation.

Time to create page: 0.154 seconds
Powered by Kunena Forum