- Posts: 53
- Thank you received: 0
Product Picture Link
13 years 1 month ago #119898
by ngt13
Product Picture Link was created by ngt13
Hi Guys
I would like to link the product image on the product page to add to cart html link so if a user clicks the product image they add the product to the cart. Currently if you click the image a lighbox pops up and the larger image is displayed. I would like to turn this off completly and instead link the image.
Can this be done and if so how can i do it?
Many Thanks
Nick
I would like to link the product image on the product page to add to cart html link so if a user clicks the product image they add the product to the cart. Currently if you click the image a lighbox pops up and the larger image is displayed. I would like to turn this off completly and instead link the image.
Can this be done and if so how can i do it?
Many Thanks
Nick
Please Log in or Create an account to join the conversation.
13 years 1 month ago #119905
by Eliot
Replied by Eliot on topic Product Picture Link
Hi Nick,
This can be done by editing your listing view and adding some html code.
It's not really difficult and many people on the forum did it.
However, if you're not confident with coding, please give us a link to your website and we'll help you with it
You should also make sure that the "Link to the product page" option of your module/menu is enabled.
This can be done by editing your listing view and adding some html code.
It's not really difficult and many people on the forum did it.
However, if you're not confident with coding, please give us a link to your website and we'll help you with it
You should also make sure that the "Link to the product page" option of your module/menu is enabled.
Please Log in or Create an account to join the conversation.
13 years 1 month ago #119912
by ngt13
Replied by ngt13 on topic Product Picture Link
Thanks Eliot
I dont mind giving it a go. I think i have found the file in:
DISPLAY>VIEWS>TEMPLATE>PRODUCT>LISTING
What im not so sure about is what part of the code to edit? Also do i input the "add to cart html link" code?
Thanks
I dont mind giving it a go. I think i have found the file in:
DISPLAY>VIEWS>TEMPLATE>PRODUCT>LISTING
What im not so sure about is what part of the code to edit? Also do i input the "add to cart html link" code?
Thanks
Please Log in or Create an account to join the conversation.
13 years 1 month ago #119962
by Xavier
Replied by Xavier on topic Product Picture Link
Hi,
Generally the file to edit is "product / show_default" via the menu Display > Views of HikaShop.
This is the product page view, it's not the "listing" one.
You have to edit the code for the image, you can remove it and add a common html tag to display the image.
The image link is in the variable "$this->element", around this tag add the add to cart button html tag.
And you will have the images which are adding the product to the cart when clicking on it.
The code to replace is:
And an example of the html link can be found in the toolbar of the product edition page.
Generally the file to edit is "product / show_default" via the menu Display > Views of HikaShop.
This is the product page view, it's not the "listing" one.
You have to edit the code for the image, you can remove it and add a common html tag to display the image.
The image link is in the variable "$this->element", around this tag add the add to cart button html tag.
And you will have the images which are adding the product to the cart when clicking on it.
The code to replace is:
Code:
//LAYOUT show_block_img
$this->row = & $this->element;
$this->setLayout('show_block_img');
echo $this->loadTemplate();
Please Log in or Create an account to join the conversation.
13 years 1 month ago #120128
by ngt13
Replied by ngt13 on topic Product Picture Link
Hi Xavier
Thanks for the feedback. This is not working for me. Under "product/show_default" i can not find:
I only see this:
At this point i have no idea where exactly to put the html add to cart code. Can you help?
Another question if i put this code in the universal product display, as the add to cart html code is product specific, if i add to cart for different products wont just one product be added to cart. How do i change this so the right product is added to cart when i click the product image? I hope this makes sense haha
Many thanks
Nick
Thanks for the feedback. This is not working for me. Under "product/show_default" i can not find:
Code:
//LAYOUT show_block_img
$this->row = & $this->element;
$this->setLayout('show_block_img');
echo $this->loadTemplate();
I only see this:
Code:
$this->row = & $this->element;
$this->setLayout('show_block_img');
echo $this->loadTemplate();
At this point i have no idea where exactly to put the html add to cart code. Can you help?
Another question if i put this code in the universal product display, as the add to cart html code is product specific, if i add to cart for different products wont just one product be added to cart. How do i change this so the right product is added to cart when i click the product image? I hope this makes sense haha
Many thanks
Nick
Please Log in or Create an account to join the conversation.
13 years 1 month ago #120176
by Eliot
Replied by Eliot on topic Product Picture Link
You're at the right place.
Point is you need some good php skills before starting this because you will have to add some js code in order to add your product to the cart. You can get some inspiration from the function displayButton in the file cart.php of administrator/com_hikashop/helpers
As Xavier said you'll have to use the informations stocked in $this->element to create a dynamic code.
If it sounds to difficult for you, you can still ask on the Commercial Jobs forum
.
Point is you need some good php skills before starting this because you will have to add some js code in order to add your product to the cart. You can get some inspiration from the function displayButton in the file cart.php of administrator/com_hikashop/helpers
As Xavier said you'll have to use the informations stocked in $this->element to create a dynamic code.
If it sounds to difficult for you, you can still ask on the Commercial Jobs forum
Please Log in or Create an account to join the conversation.
Time to create page: 0.207 seconds