Wrong item id from articles with product plugin bt

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #165978

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.5.11
-- Browser(s) name and version -- : all

Hello,
I've a non-hikashop carousel in homepage (see my url and look in the "HIGHLIGHTS" tab) that loads joomla articles and some of these contains hikashop product links created with the product button during the editing of the joomla article.

I've manually set the correct menu-item-id and dig in the code to know if it is correctly retrieved by the plugin...it is,
but after the plugin view (hikashopproductinsert_view) evaluate the $link variable ($link = hikashop_contentLink) this changes wrong.
I've set some comment in the code just after the opening of the <div class="hikashop_inserted_product"> tag,
you will seet that the itemid is different for each of these articles, but the $link variable points always to the same menu-item-id
What's wrong ?

Thank you for any suggestion

Last edit: 11 years 1 month ago by gulp.

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

  • Posts: 12953
  • Thank you received: 1778
11 years 1 month ago #166015

Hello,
Did you use the "Menu ID" option when you add you product tag on your article ?

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

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #166079

Yes, as you could see at my url the menuid is set (please read the comment in the html code as described), but after the evaluation of $link = hikashop_contentLink the itemid is always the same for the articles that comes with a product code.
I've temporarly solved this issue adding $url_itemid at the end of $link to reset the itemid value to that one correct

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 1 month ago #166134

The contentLink function automatically changes the menu id if the type of the menu id is not correct. It should be either a product listing or a category listing.

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

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #166337

Hello,
thank you for your answer but something don't seems to be clear:
if I have a product I can recall it from the joomla article ui by using the "product" button for hikashop.
This sets me a code like this on the editor:

{product}2|link|picture{/product}
To this code I could add a param to identify the menu-item-id I would like to use when the user clicks the link.
I go to the menu items in joomla and get the menu item that points to that product (then this menu item should a product page menu item !),
copy the item-id and paste to the previous code obtaining something like this:
{product}2|link|picture|menuid:419{/product}

The hikashop plugin runs when the article come loaded and before the contentLink function correctly evaluate the destination page.
Why contentLink() should change the menu id if the type is correctly "product" ?

I don't understand what to change or where to dig in to find the error ...

Please, could you take a look to my site ?

Thank you in advance

Last edit: 11 years 1 month ago by gulp.

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 1 month ago #166385

Hi,

That's normal. The system won't change the id if it's a products listing or a categories listing. If it's a product page, the id will be changed to a products listing or a categories listing.
It is done automatically in order to avoid 404 SEF errors.
So there is no error, because it's not an error but the proper behavior of the system.
If it want to use product page item ids for your tags, it's not impossible.
Just change the code of the hikashopproductinsert_view file of the plugin so that it calls the function hikashop_completeLink instead of the function hikashop_contentLink and it will keep the item id you entered in the tag, no matter what.

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

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #166436

Did you change this behaviour in the latest update ? Before it doesn't seems to works like this ...
What about updates ? My changes will be overwritten ?

Why do you make the system work like this ? If I point to a product what the need to point to a list instead of that single ?

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 1 month ago #166447

Yes. We changed the behavior with the last update.
Before, it was directly using the menu item id you specified, and if you specified a wrong one, you had an error. Now, it auto-corrects it.
If you copy the hikashopproductinsert_view.php file to the folder templates/YOUR_TEMPLATE/system (that you'll have to create first), and then that you modify the copy of the file, you won't loose your changes when you update.
Usually, you don't point a product tag to a product page menu since it's a lot of work to create one menu item per product and it's prone to errors as if you enter the menu item id of another product than the one of the tag, it won't work. It's much easier and less error prone to just have one menu item which lists the products, and give the menu item id of that menu for all the product tags.

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

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #166586

I understand the reason of this change but I would like to suggest you to dig in for an improvement:
sometimes it is really necessary to use a direct menu item, then for us there is no other solution to override the code...losing some optimization for sure !
For example I create some joomla articles as news-scroller or carousel (not by hikashop) that could be related to products or not, then if the user like to see the product listed it should be useful to point him the the right page ... Unfortunately we have to set also the correct menu item to load al the modules that the page needs ...

Thank you

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

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #166591

And thank you for the override suggestion:
the folder path you suggest is working, but it is different by the reference of Joomla that suggest to put the "system" folder under the "html" folder ...

:dry:

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

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #166598

At last, the hikashop_completeLink() doesn't works fine:
it produces an url that adds the param tmpl

&tmpl=component
that loads something wrong and breaks the page ... at the moment I'm forcing the ItemId as previously described

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 1 month ago #166622

Hi,

1. We won't change that. You're not supposed to use a menu item of the type product page in that case and I still don't see the point. If you want to have different modules for different product pages, that's not a problem. Just enter the canonical URL you want with the menu item you want in the options of the product and turn on the "Force canonical URLs on listings" option of the configuration so that it uses that URL instead of a generated one. That way you'll have the URL you want on the product content tag, without specifying the item id in the tag.

2. Joomla has never suggested to override plugin views since plugins don't have any views normally. That's something we added there for ourselves. There is no particular problem with having the view overrides for plugins in another folder than the HTML folder.

3. That's because you need to remove the second parameter of the call of hikashop_completeLink as it has a different meaning than the one of the hikashop_contentLink function call.

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

  • Posts: 99
  • Thank you received: 2
11 years 1 month ago #166676

1. Thank you for this suggestion but I can't use the canonical url until the site is in developement because I've some testing domain (local and remote) and if I have to add the domain to set the canonical url it will works just for one ... (I don't know if I've understood the correct setting of canonical url ...)
2. ok thanks
3. It doesn't works anyway, removing the 2nd parameter it removes also the itemid from the resulting link variable

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

  • Posts: 99
  • Thank you received: 2
11 years 2 weeks ago #168765

Hello,
any advice about the 3rd point ?

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 11 months ago #172288

Hi,

I see that this thread does not have an answer, I hope that I will have a fresh eye on the problem.
Would it be possible to have more details about your hikashop_completeLink problem ?
How do you use the function, what's the exact trouble ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #172468

At present I'm using this code:

$link = hikashop_completeLink('product&task=show&cid='.$product->product_id.'&name='.$product->alias.$url_itemid);
but still having some issue because of the carousel against hikashop products:
the titles of the articles should be made by the carousel (because contains also simple articles) then cannot be changed by hikashopproductinsert_view plugin, then it comes that the title goes to the wrong page, even if the product image goes to the correct page.

Thank you for any suggestion

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 11 months ago #172499

Hi,

Where is it possible to see the carousel in action ?
I need to see the context in order to understand ; having the line is not useful if we don't know the content of the parameters.
What is the content of the "$url_itemid", what is the ItemId of the page where the carousel is displayed, what menu are you targeting ?
It is a sample of question I could have ; which will help me to understand the global context of the page where the carousel is.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 10 years 11 months ago by Jerome.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #172622

Hello,
I've sent you a pm to show you my local ip address.
Please see the difference by the title of the elements in the carousel and the image ...

Thank you for help

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 11 months ago #172679

Hi,

Thanks for your PM.
I don't understand what you was talking about in your private message and what you're talking about in your last message here.
There is no link between them, one time you're talking about a carousel and the other time you're talking about articles and "product insert".

I am sorry but I don't understand your problem ; I am not able to help you correctly in these conditions.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 99
  • Thank you received: 2
10 years 11 months ago #172838

Don't you worry about this, I'll try to find another solution because it is not clear to me which plugin is creating this kind of issue,
then it could be also that Hikashop is working good but it is not used by our team in the correct way, I'll better investigate before asking this that is complicate to explain.

Thank you again

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

Time to create page: 0.093 seconds
Powered by Kunena Forum