Product variant doesn't keep canonical url

  • Posts: 132
  • Thank you received: 2
  • Hikaserial Standard Hikashop Business
10 years 2 months ago #193494

-- HikaShop version -- : 2.4.0 & 2.3.5
-- Joomla version -- : 3.4.0 & 3.3.6
-- PHP version -- : 5.3.10

Hi!

We've noticed that when we have add products to our basket / Cart and hover over the product name (which is a link) the link is

/component/hikashop/<product alias>.html

instead of the set product canonical url.

This only affects products with variants as products with no variants displays the correct url.

The wrong URL is only used/displayed in the Basket / checkout page.

It should be noted that we are using 3 seperate pages / Menu points for our shop,

Page/Menu 1: Joomla Article which loads hikashop content module (Used as product listing).

Page/Menu 2. Hikashop product listing (Only used to display the product pages)

Page/Menu 3: Hikashop checkout (In configuration hikashop checkout is also forced to this menu).

It should properly also be noted that in the "Feautes -> SEF url options" we have deleted the Product SEF name and Checkout SEF name and are using the menu's name instead.

This error occurs both on hikashop 2.3.5 on Joomla 3.3.6 and on Hikashop 2.4.0 on Joomla 3.4.0

Last edit: 10 years 2 months ago by earmaster.

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

  • Posts: 132
  • Thank you received: 2
  • Hikaserial Standard Hikashop Business
10 years 2 months ago #193858

I did some testing and it seems like the issue lies with the automatic assignment of the main products URL to the product variant URL. Because from what I could see is that if I assign a product a canonical URL through the backend, the URL won't be applied to the variants and will then receive/generate a url for the variants when we visit /list the product (on the frontend) instead of the canonical url we defined in the backend.

So I don't know whether it's just simply to make sure that the canonical url is attached to the variants when you hit the "save" button in the backend

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

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 2 months ago #193977

Hi,

Add the line:
$variant->product_canonical = @$element->product_canonical;
after the line:
$variant->main_product_quantity_layout = @$element->product_quantity_layout;
in the file administrator/components/com_hikashop/classes/product.php and that should allow the system to use the canonical URL for products with variants on the cart display.

The following user(s) said Thank You: earmaster

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

  • Posts: 132
  • Thank you received: 2
  • Hikaserial Standard Hikashop Business
10 years 2 months ago #194012

Thanks! That solved it!

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

Time to create page: 0.060 seconds
Powered by Kunena Forum