Skip to main content

Alias automatic filling is not working

More
11 years 7 months ago #193434 by ifenix
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.0

Hi.
Help me please. What I do wrong?
After import of products field alias - blank.
If Alias automatic filling - yes field must be filled from the product title?

I Remove products and categories id in URLs and Force canonical URLs on listings - Use canonical URL and generate it if missing

Products are available in the list of products,. they have canonical URLs. But I get a "product not found" on the product card. If I to save product in the backend - alias is created. and the product is available in product card. This is for a single product, but they are many...

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

More
11 years 6 months ago #193573 by nicolas
Hi,

The auto filling of aliases is done at the saving of the product. So that's normal that they are not filled until you save the products.
One possibility is to have a product_alias column in your CSV and import the CSV with the alias prefilled for all your products.

It's normal that you get the error with you turn on the remove ids from URLs and the Force canonical URLs.
Your canonical URLs don't have the id in them, so the only thing the system can rely on when you click on the link is the text of the product in the URL. If you don't have the aliases filled, the text in the URL will come from the product name and if that text is different from the name, it won't be able to find the product as it doesn't have any valid identification mean.

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

More
11 years 6 months ago - 11 years 6 months ago #193620 by ifenix
Thanks for the answer.
The problem is that in my CSV file no field product_alias. But I added option to auto filling alias when importing CSV.
Added code to the function _insertOneTypeOfProducts (administrator/components/com_hikashop/helpers/import.php) on line 1792
Code:
$config =& hikashop_config(); if($config->get('alias_auto_fill',1) && $field=='product_alias' && empty($product->product_alias)){ $product->product_alias = strip_tags(preg_replace('#<span class="hikashop_product_variant_subname">.*</span>#isU','',$product->product_name)); } if($config->get('sef_remove_id',0)){ $int_at_the_beginning = (int)$product->product_alias; if($int_at_the_beginning){ $product->product_alias = $config->get('alias_prefix','p').$product->product_alias; } } $config = JFactory::getConfig(); if(!$config->get('unicodeslugs')){ $lang = JFactory::getLanguage(); $product->product_alias = $lang->transliterate($product->product_alias); } $app = JFactory::getApplication(); if(method_exists($app,'stringURLSafe')){ $product->product_alias = $app->stringURLSafe($product->product_alias); }else{ $product->product_alias = JFilterOutput::stringURLSafe($product->product_alias); }

Automatic creates an alias if:
  • field alias - blank
  • Alias automatic filling - yes
  • CSV file haven't a product_alias column


This code works. But I do not know Is this right...
Last edit: 11 years 6 months ago by ifenix.

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

More
11 years 6 months ago #193645 by nicolas
Hi,

That's indeed a possibility yes. The code looks ok.
The following user(s) said Thank You: ifenix

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

Time to create page: 0.235 seconds
Powered by Kunena Forum