Link to offsite purchase for certain products

  • Posts: 6
  • Thank you received: 0
11 years 4 months ago #112406

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.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #112425

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:

<?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.

  • Posts: 6
  • Thank you received: 0
11 years 4 months ago #112463

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.

  • Posts: 6
  • Thank you received: 0
11 years 4 months ago #112464

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.060 seconds
Powered by Kunena Forum