ugurterzi Posted May 17, 2017 Share Posted May 17, 2017 Hi guys, are there any one who can suggest me a sample hooks code for this particular need: We would like to output a custom html block in to the cart page where before id="order-standard_cart" for this kind of specific link: /cart.php?a=add&pid=17 It would be a huge help if you can help me. Best Regards, 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 17, 2017 Share Posted May 17, 2017 you can't really use a hook like that (with a few exceptions) to output in specific locations if the template isn't expecting it. for something like this, it would just be easier to edit the template. 0 Quote Link to comment Share on other sites More sharing options...
ugurterzi Posted May 17, 2017 Author Share Posted May 17, 2017 Hi Brian, thank you for your explanation. How would you do it if you were just wanted to output a simple html block in to the cart page for a specific product? I am asking this why we need to display this html block for only one particular/specific product what it is in the cart. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 17, 2017 Share Posted May 17, 2017 Hi, How would you do it if you were just wanted to output a simple html block in to the cart page for a specific product? I am asking this why we need to display this html block for only one particular/specific product what it is in the cart. I can think of two quick ways, and which to choose will depend on what you want to display and where, would be to either... 1. add your html code to the product description itself (via the product setup in the admin area) - you can add HTML to your description, so depending on what you want to add for this one product, you may be able to do it this way. 2. edit the products.tpl template and somewhere appropriate for the layout in the {foreach $products as $key => $product} loop, add the following Smarty code... {if $product.pid eq "17"} *your html code* {/if} 0 Quote Link to comment Share on other sites More sharing options...
ugurterzi Posted May 17, 2017 Author Share Posted May 17, 2017 Oh! I'll definitely try this one. And'll share the result. Many thanks. 0 Quote Link to comment Share on other sites More sharing options...
ugurterzi Posted May 17, 2017 Author Share Posted May 17, 2017 I tried to add this one: {if $product.pid eq "17"} <h1>test me</h1> {/if} It doesn't output the html. I removed the if statement (for testing if I am working on the correct file) it worked. Do you have any suggestion? thanks. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 17, 2017 Share Posted May 17, 2017 I tried to add this one:It doesn't output the html. I removed the if statement (for testing if I am working on the correct file) it worked. Do you have any suggestion? thanks. it works when I try it in standard_cart... {if $product.pid eq '3'}<h1>test me</h1>{/if} are you should the pid value is correct ? 0 Quote Link to comment Share on other sites More sharing options...
ugurterzi Posted May 17, 2017 Author Share Posted May 17, 2017 yes but my product (I'm sure the ID is true) is coming with a one year free domain so the file is configureproductdomain.tpl (I copied it from the standard cart in to our custom order form firectory) that I'm trying to edit. Is that might be related with that? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 17, 2017 Share Posted May 17, 2017 yes but my product (I'm sure the ID is true) is coming with a one year free domain so the file is configureproductdomain.tpl (I copied it from the standard cart in to our custom order form firectory) that I'm trying to edit. Is that might be related with that? oh ok, you should really have included a screenshot so I knew which page you were talking about - I think nearly all of them include <div id="order-standard_cart"> !! once you get past the products page, you should be able to use either... {if $pid eq '17'}<h1>test me</h1>{/if} or {if $productinfo.pid eq '17'}<h1>test me</h1>{/if} 0 Quote Link to comment Share on other sites More sharing options...
ugurterzi Posted May 17, 2017 Author Share Posted May 17, 2017 My bad sorry the code: {if $pid eq '17'}<h1>test me</h1>{/if} is worked like a charm!! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.