Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

add to cart button on homepage new product listing + search results

add to cart

3 replies to this topic

#1 yellowboy

  • Community Member
  • 4 posts
  • Real Name:Tuan

Posted 31 December 2011, 18:44

Hi Guys,

I new and don't know jack about PHP so go easy on me

How do i add a 'add to cart' button on the product listing and search results page. NOT the page which shows details when you click on the item but the page which shows multiple items and also the search result page

examples -

search result page
http://livedemo00.template-help.com/osc_34684/advanced_search_result.php?keywords=gloves&x=0&y=0

homepage
http://livedemo00.template-help.com/osc_34684/index.php

thanks in advance guys

By the way im using oscommerce-2.3.1

Edited by Jan Zonjee, 22 January 2012, 13:38.


#2 iankil

  • Community Member
  • 112 posts
  • Real Name:Janne.k
  • Gender:Male
  • Location:Stockholm Sweden

Posted 02 January 2012, 14:03

Hi, you can use this code and paste in in /includes/modules/product_listing.php:

<a href="' . tep_href_link('product_info.php','products_id=' . $listing['products_id']) . '"><img src="layout/images/more_info.gif" border="0" alt=" " /></a> <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '"><img src="layout/images/button_buy_now.gif" border="0" alt=" " /></a>

its a "more info" and a "buy now" button. These buttons requires two images, button_buy_now.gif and more_info.gif

The most simple way to do this is to download my Horizon2.3 template from the add on page http://addons.oscommerce.com/info/8289 and open the file and take a look. You will also find the buttons there.

Good Luck
/Janne
My contributions
Mindsparx admin for 2.2
Mindsparx admin for 2.3
Mindsparx admin for 3.0
Mindsparx specials 2.2
Starproduct pimped for 2.2
Starproduct pimped for 2.3
Mindsparx template osc Sport 2.2
Mindsparx template Horizon 2.3
+ a few more...

#3 bhbilbao

  • Community Member
  • 291 posts
  • Real Name:BLACKHOLE
  • Gender:Male
  • Location:Spain

Posted 03 January 2012, 18:15

I need to get the products_id as variable($listing[$x]['products_id']) from product_listing.php page after clicking other submit button (quote_button.gif)

After clicking the quote button, it goes to the other page but the variable $quote is empty.
How can i get it??.

#4 yellowboy

  • Community Member
  • 4 posts
  • Real Name:Tuan

Posted 06 January 2012, 00:04

View Postiankil, on 02 January 2012, 14:03, said:

Hi, you can use this code and paste in in /includes/modules/product_listing.php:

<a href="' . tep_href_link('product_info.php','products_id=' . $listing['products_id']) . '"><img src="layout/images/more_info.gif" border="0" alt=" " /></a> <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '"><img src="layout/images/button_buy_now.gif" border="0" alt=" " /></a>

its a "more info" and a "buy now" button. These buttons requires two images, button_buy_now.gif and more_info.gif

The most simple way to do this is to download my Horizon2.3 template from the add on page http://addons.oscommerce.com/info/8289 and open the file and take a look. You will also find the buttons there.

Good Luck
/Janne


Hi Janne,

thanks for you help but the page im referring to is /includes/modules/new_products.php

below is where i "THINK" needs modification

$new_prods_content .= '<div class="item"><div class="item-name"><center><p><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></p></center></div><div class="item-image"><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></div><div class="item-price"><p>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</p></div></div>';


This is the original version plus a few css tweaks to add my classes

any suggestions?

Yellowboy