Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Creating a Storefront page


Spekkio

Recommended Posts

Posted

The site I'm working on requires this storefront page. Is there an easy way to the "Add to Cart" buttons to work? So far I have found the following code to change the image into a link:

 

<?php 
       echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
   ?>

 

What else do I need to do?

 

~Nate B.

Posted

1) Create the form

2) Populate with a loop (I assume you already are based on the code above)

3) Close the form as you already have

 

In short, it looks like the only thing missing from your code is the opening form tag [rathr, tep_draw_form()].

 

Bobby

Posted
1) Create the form

2) Populate with a loop (I assume you already are based on the code above)

3) Close the form as you already have

 

In short, it looks like the only thing missing from your code is the opening form tag [rathr, tep_draw_form()].

 

Bobby

 

Thanks for your help. I now have the following code:

 

<?php 
     echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
       echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
   ?>

 

But when I click on a button, it says product not found. How do I get the correct product assigned to it? I guess what I'm asking is how exactly do you create a form?

  • 2 weeks later...
Posted

OK, so I kind of have this working. However, now whenever I click on the add to cart button, it adds the product to the cart, but it also takes me to another page and says that the product is not found. Here's the code I'm using :

 

<?php 
     $product_info[products_id] = 40;
     echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
       echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
   ?>
   </form>

I'm just doing this for each button I'm using. Any ideas on what I'm doing wrong?

 

Thanks,

 

~Nate B.

Posted

I feel kind of dumb now. :blush:

 

All I needed to do was change FILENAME_PRODUCT_INFO to FILENAME_STOREFRONT, and now it works great. Hope this helps someone else out someday. :rolleyes:

 

~Nate B.

Archived

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

×
×
  • Create New...