Digital experiences for all disciplines
New Landing › How can we help? › Atelier › Add download link under product image in single product page
New Landing › How can we help? › Atelier › Add download link under product image in single product page
- This topic has 5 replies, 3 voices, and was last updated 6 years by David Martin – Support.
-
Posted in: Atelier
-
June 22, 2017 at 6:56 pm #329790
Hello, I’m trying to integrate a download link under each products with their respective download links(which are uploaded when the product is set as downloadable). I’m aware that this system works only when you buy the product, but I would like to change it.
So my question is; where in the files is the location for the product image for the single product page, so I could place a button underneath? I’ve looked in single-product.php, content-single-product.php, content-product.php and was not able to trace down the main image that’s zoomable. I would really appreciate it! Thank you.June 23, 2017 at 4:16 pm #329912Hi,
The product image slideshow HTML is powered by WooCommerce, not the theme. Editing the template files is the wrong method, you will want to override the functions we have in our framework using a child theme.
You can also hook into the supplied actions seen throughout the template files with your own functions.
Knowing this, in the file
content-single-product.php
you will find the actionwoocommerce_before_single_product_summary
. This is located after the main product image.You can then hook into that action to add your own content via your own custom function which you would add to your child theme
functions.php
file.Thanks.
June 23, 2017 at 4:16 pm #329913Hi,
Check in atelier/woocommerce/loop/ those files are the responsible for the product loop in the shop page.
-Rui
July 4, 2017 at 9:28 pm #330973Thank you very much for your replies!
@Rui Guerreiro: I appreciate your help, however I was talking about the single product’s page.
@David Martin: I appreciate your support.
Could someone help me to find the way to get the download link of the specified product? I am trying to find my way through WordPress, and my personal method would be to execute a SQL query to fetch the download link(which I suppose is categorized as a wp_post entry). However, I know there’s a better and more secure way by using hooks and whatnot.Thank you in advance.
July 4, 2017 at 9:55 pm #330974I have solved my problem. This did the trick:
$downloads = $product->get_files(); $dlcount = 0; foreach( $downloads as $key => $each_download ) { if ($dlcount == 0) echo '<div class="title-wrap"><h3 class="spb-heading" style="text-transform: uppercase;"><span>Download</span><h3></div>'; echo ' <a style="margin-left: 10px;" href="'.$each_download["file"].'" target="_blank">'.$each_download["name"].'</a><br>'; $dlcount++; } if ($dlcount > 0) echo '<div style="padding-bottom: 50px;"></div>';
Thank you for your help!
July 5, 2017 at 12:30 pm #331018Glad to help you out!
If you have found the theme/support useful, we appreciate it if you can leave feedback on our item if you have the time as it really helps us out.
Thanks,
David -
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.