Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2007
    Posts
    169
    Plugin Contributions
    0

    Default Where is PHP code for Add-to-cart?

    Can someone point to me the PHP code that is executed when the "Add to Cart" button is clicked?

    And is there any significance to having the attribute "enctype="multipart/form-data" in the <form> that contains the "add-to-cart" button?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Where is PHP code for Add-to-cart?

    Quote Originally Posted by artcoder View Post
    Can someone point to me the PHP code that is executed when the "Add to Cart" button is clicked?
    Yes, lotsa stuff. Various files in the init_includes folder, the main_cart_actions.php file, the extra_cart_actions folder, application_top, the shopping_cart class, and more.

    A better question is ... what are you wanting to accomplish?

    Quote Originally Posted by artcoder View Post
    And is there any significance to having the attribute "enctype="multipart/form-data" in the <form> that contains the "add-to-cart" button?
    Yes, That's important in order to handle any uploads that your customers might do using upload-file attributes on your products.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2007
    Posts
    169
    Plugin Contributions
    0

    Default Re: Where is PHP code for Add-to-cart?

    Thanks. What I am trying to accomplish is that I have a custom PHP page added to the shop where I put some buttons like the following ...

    Code:
    <form name="mycartpostform" id="mycartpostform" action="index.php?main_page=shopping_cart&amp;action=add_product" method="post" enctype="multipart/form-data">
    <input type="hidden" name="products_id" value="124" />
    <input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart " />          
    </form>
    where if the user clicks the button, it adds product 124 to cart.

    I'm trying to figure out how to re-construct this form so that it adds both product 124 and 125 to cart.

    I tried ...

    Code:
    <form name="mycartpostform" id="mycartpostform" action="index.php?main_page=shopping_cart&amp;action=multiple_products_add_product" method="post" enctype="multipart/form-data">
    <input type="hidden" name="products_id" value="124" />
    <input type="hidden" name="products_id" value="125" />
    <input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart " />          
    </form>
    But no luck. It seems to only add the last product number 125.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Where is PHP code for Add-to-cart?

    It should be an array.
    The value should be the qty to be adding to the cart.
    Code:
    <input type="hidden" name="products_id[124]" value="1" />
    <input type="hidden" name="products_id[125]" value="1" />
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jan 2007
    Posts
    169
    Plugin Contributions
    0

    Default Re: Where is PHP code for Add-to-cart?

    Thanks! got it.

 

 

Similar Threads

  1. Where to add in code for dynamic drive credit?
    By pb4 in forum General Questions
    Replies: 1
    Last Post: 20 Apr 2011, 11:36 AM
  2. Where's the Add to Cart: text in tpl_product_info_display.php?
    By datatv in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 12 Jun 2008, 02:24 AM
  3. anyone know the php code for the 'add to cart' button
    By what44 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 2 Nov 2007, 05:00 PM
  4. Where is this PHP code for shop cart?
    By artcoder in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Apr 2007, 08:43 PM
  5. HELP! php code to add to cart
    By utah_aviator in forum General Questions
    Replies: 3
    Last Post: 7 Dec 2006, 12:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg