Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add buy now button on the "what's new" home page


aurora_cues

Recommended Posts

I have added a buy it now button on the new product page ( home page) so I just want to share it here.

 

I was having problem before when the button would not add the product to the cart and only showed an empty cart.

 

I searched the forum left and right but came up dry. I then realized it was the product id that needed to be changed in the code. I had action=buy_now&products_id=' . $listing['products_id'] after I changed it to . $new_products['products_id'] it now works.

 

Feel free to test it yourself: shop.auroracues.com

 

Add to cart is the same deal but just make sure you have 'action=buy_now&products_id=' . $new_products['products_id']

 

This is what I did:

 

In includes/modulus/new_products.php

 

After:

 

$new_prods_content .= '<td width="33%" align="center" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' .

$new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) .

 

Add:

 

//add buy now button

'<br />' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, null , tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'])) .

//end buy now button

 

So the whole thing should look something like this:

 

$new_prods_content .= '<td width="33%" align="center" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' .

$new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) .

//add buy now button

'<br />' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, null , tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'])) .

//end buy now button

'</td>' ;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...