Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Changing BUY NOW button to SPONSOR NOW in one category

Changing BUY NOW button to SPONSOR NOW in one category

Views: 992

Results 1 to 8 of 8
4 Sep 2015, 8:27 PM
#1
tomig avatar

tomig

New Zenner

Join Date:
Sep 2015
Location:
Colorado
Posts:
3
Plugin Contributions:
0

Changing BUY NOW button to SPONSOR NOW in one category

Looking for guidance on changing out the BUY NOW button to a SPONSOR NOW button in one category only. The other four categories would remain the same with BUY NOW as we also sell products.

The SPONSOR NOW button would do the same thing as BUY NOW. We are a non-profit and the SPONSOR NOW is for sponsoring children. BUY NOW isn't too good to use.

Thank you in advance for your guidance.

5 Sep 2015, 2:54 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Changing BUY NOW button to SPONSOR NOW in one category

This will require a bit of custom coding and relies upon all of them being in the same category

5 Sep 2015, 7:19 AM
#3
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Changing BUY NOW button to SPONSOR NOW in one category

I haven't looked in to the details, but couldn't this be done by using a custom product_type? Giving this product type a sponsor button in stead of the regular buy button?

5 Sep 2015, 10:34 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Changing BUY NOW button to SPONSOR NOW in one category

Haven't tried it yet, but what about using some form of css replacement of the image or overlay?

Btw, if you are going a more purist route, there are some "internal" switches that would need to be modified as well... Look at the uri when clicking on a Buy Now button. Has action=buy_now... I would almost suggest simply finding a common ground term/phrase to be used throughout.

No the button is not initially product type specific as the code for the button can be found in product_listing, all products, featured products, and new products. An indicator like a product type could be helpful as compared to a category because what if some non-child product were added to the category that is related to the children but not one to be "sponsored"...

So, here's what I did to figure out where the code was to address this: I went to tools->developers tool kit. In the lower left corner I typed in 'buy now'. (No quotes) this brought up a define for: BUTTON_BUY_NOW_ALT (at least in ZC 1.5.4). This provided several files that could be altered to "filter" on the desired criteria in order to display the desired button (though still thinking that might be possible through CSS).

6 Sep 2015, 5:44 PM
#5
tomig avatar

tomig

New Zenner

Join Date:
Sep 2015
Location:
Colorado
Posts:
3
Plugin Contributions:
0

Re: Changing BUY NOW button to SPONSOR NOW in one category

Thank you all for the input and your time!

6 Sep 2015, 6:38 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Changing BUY NOW button to SPONSOR NOW in one category

You could customize the code in:
/includes/modules/products_listing.php

using your templates and overrides directory and change the code around line 134 to include the code in RED:

// qty box with add to cart button
            if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
              $lc_button= zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
            } else {
[B]// bof: special buy now button for master_categories_id 53
if (zen_get_products_category_id($listing->fields['products_id']) == 53) {
              $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button('button_buy_now2.gif', BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
} else {[/B]
              $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
[B]}
// eof: special buy now button for master_categories_id 53
[/B]            }
          }
        }
        $the_button = $lc_button;
8 Sep 2015, 4:56 PM
#7
tomig avatar

tomig

New Zenner

Join Date:
Sep 2015
Location:
Colorado
Posts:
3
Plugin Contributions:
0

Re: Changing BUY NOW button to SPONSOR NOW in one category

Thank you Ajeh!

8 Sep 2015, 11:25 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Changing BUY NOW button to SPONSOR NOW in one category

You are most welcome ... :smile: