Skip to main content

Link to offsite purchase for certain products

13 years 4 months ago #112406 by dkudler
At my site (stillpointdigital.com), I have a shop that mostly sells ebooks , which can be purchased and downloaded directly from my HikaShop.

I also, however, have a number of audiobooks that are sold exclusively through Audible.com.

What I am trying to do is figure out a way to change the "Add to Cart" button conditionally. If the product is in the category "Audiobook", say, I'd love to have the button read "Purchase at Audible" and link to the Audible page (which is already entered as the Brand URL for each product).

Is this possible without completely rewriting the code? If not, can you point me to where in the code I'd need to make changes?

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

13 years 4 months ago #112425 by nicolas
You will have to edit the file "quantity" of the view "product" via the menu Display->Views and add your check at the beginning. Something like that:
Code:
<?php if(!empty($this->row->product_url)){ echo '<a href="'.$this->row->product_url.'">Add to cart</a>'; return; } ?>

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

13 years 4 months ago #112463 by dkudler
Cool! Thanks!

I take it that the "else" would be an echo containing the button/link I'm looking to add, right?

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

13 years 4 months ago #112464 by dkudler
Whoops! Missed the ! at the beginning of the check.

I think I've got it. Thanks.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum