- Posts: 60
- Thank you received: 1
How do assign templates to views?
I would like a user to click on a product in the product listing so that when they view the Product item it is in the Hikashop template version.
I hope that makes sense
Crispin Jones
Please Log in or Create an account to join the conversation.
If you're using the default settings, it will be the file "listing_img_title" where you will have to change:
$link = hikashop_completeLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway);
to:
$link = hikashop_completeLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.'&Itemid=XXX'.$this->category_pathway);
where XXX is the id of a menu item (a product listing menu item for example) for which your hikashop template is assigned.
Please Log in or Create an account to join the conversation.
Thank you for your response. I'm still a little confused as looking through the views many of the templates seem to be linked to a selection of the available templates. I've included a screen grab. Even, apparently, frontend, views are linked to administrator templates. The attached is filtered for frontend.
As I'm going to have to show my client how to manage this and I don't really expect them to customise the code, is their a simple way they could manage this aspect of the site. I have set up specific menu items where relevant so that templates can be assigned. To make your suggestion work I gather I would need to create a menu item for each product. But your suggestion would appear create a fixed path ...$this->xxx.$this... where I would be using a specific menu id rather than using the reference ...$this->itemid.$this...
Have I got this completely wrong?
Thanks
Crispin
Please Log in or Create an account to join the conversation.
I have confirmed that the modified view is the active template.
Whatever Joomla template I set to the menu item appears to be the one that applies through out the shopping process.
This is not an issue unique to your product I know.
Crispin
Please Log in or Create an account to join the conversation.
But for the product pages, that modification will be required.
As I said, XXX needs to be the id of a products listing menu item. You don't have to have one menu per product or whatever. Just create one with the default options and use its id.
Please make sure that the modification saved. If you don't see the modification, it could also be that you're not using the "image and title" item box layout for your listing. In that case, you should edit the view file you're using... There are 10 possibilities... I wouldn't be able to tell you which one without looking at your shop.
Please Log in or Create an account to join the conversation.
I have made the changed you suggest.
Using a menu item I have created in the Hikashop admin
The template used for the listing page is assigned. The template intended for the Item page is default
The listing page [url=http://http://cavespidertemp1.co.uk/index.php?option=com_hikashop&view=product&layout=listing&Itemid=170] cavespidertemp1.co.uk/index.php?option=c...t=listing&Itemid=170 [/url]
I have placed a marker in the code so that I could be sure the relevant HS template view was applied. <!-- CVS PRODUCT IMG-amended listing-image-title -->
Plainly I have missed something obvious
Thanks for your help
Crispin
Please Log in or Create an account to join the conversation.
Cheers
Crispin
Please Log in or Create an account to join the conversation.
The problem is that you have deactivated the "link to product pages" option of your listing so the image/name is not clickable. So the $link variable is not used.
And only the add to cart button is displayed. And since your products have variants, instead of the add to cart button, you have the choose options button displayed which has his own link.
So you need to go edit the file "quantity" of the view "product" via the menu Display->Views and change the line:
echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.$this->itemid),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.$this->itemid)).'\';return false;','');
to:
echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&Itemid=XXX'),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.$this->itemid)).'\';return false;','');
Then it will work for the choose options button too.
Please Log in or Create an account to join the conversation.
For test purposes I activated the Link to product pages which works and links using the correct templates. The choose options button though it shows itemid=195 does work work as we want.
The home page here
cavespidertemp1.co.uk/index.php?option=c...t=listing&Itemid=170
The product link generates this url which now works as we'd like.
cavespidertemp1.co.uk/index.php?option=c...ng-blooms&Itemid=195
The 'Choose options' button generates this URL which doesn't work as we'd like.
cavespidertemp1.co.uk/index.php?option=c...uct_id=31&Itemid=195
And by the way, thank you very very much for all your help on this.
Crispin
Please Log in or Create an account to join the conversation.
echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&Itemid=XXX'),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.$this->itemid)).'\';return false;','');
$this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&Itemid=195'),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&Itemid=195')).'\';return false;','');
Replacing the second reference to itemid. I do hope this won't effect anything else.
Thanks again for your help.
Crispin
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Did you end up getting this working? if so, can you step me through it?thanks
Please Log in or Create an account to join the conversation.
www.hikashop.com/forum/2-general-talk-ab...s.html?lang=en#56924
Please Log in or Create an account to join the conversation.
thanks again!
Please Log in or Create an account to join the conversation.