Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2014
    Location
    Alicante
    Posts
    15
    Plugin Contributions
    0

    Default Add product to Cart URL?

    I had Zencart 1.3.8a with a jquery code that throw to "index.php?main_page=product_info&cPath=18&products_id=910&action=add_produc t" a post form with all the variables and text attributes and the shopping cart recieved the data and added it correctly.

    Now I'm trying to migrate to Zencart 1.5.1 and I've modified the jquery code with the securityToken, something that before wasn't needed, to do the same add a product through URL "index.php?main_page=product_info&cPath=18&products_id=910&number_of_uploads=0&a ction=add_product".
    But now it doesn't work the variables are sent, but the shopping cart tells that there's no product in the basket.

    And the question are: Can be done what I'm trying in Zencart 1.5.1?
    I'm using these fields of the form:
    <input type="hidden" name="securityToken" value="444444"></input>
    <input type="hidden" name="id[TEXT_PREFIX9]" value="Text"></input>
    <input type="hidden" name="id[TEXT_PREFIX5]" value="_-_-_-_-_-_-_-_-_-_-"></input>
    <input type="hidden" name="id[6]" value="22"></input>
    <input type="hidden" name="id[8]" value="68"></input>
    <input type="hidden" name="id[7]" value="67"></input>
    <input type="hidden" name="cart_quantity" value="1"></input>
    <input type="hidden" name="products_id" value="286"></input>

    Am I missing any field?

  2. #2
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,246
    Plugin Contributions
    58

    Default Re: Add product to Cart URL ZC 1.5.1

    Not a field, but rather a active session I think... without an active session and cookie set things cannot be added to the cart.
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Add product to Cart URL ZC 1.5.1

    Someone (kuroi or DrByte, I forget) posted code a year or two ago that does exactly that, open Zen Cart with a specific product in the cart, so it should be possible.

  4. #4
    Join Date
    Jun 2014
    Location
    Alicante
    Posts
    15
    Plugin Contributions
    0

    Default Re: Add product to Cart URL ZC 1.5.1

    @gjh42 I thing you are pointing to this threat: http://www.zen-cart.com/showthread.p...-via-URL/page2
    I've read and using the info in it but it doesn't work in ZC 1.5.1.

    @mprough You're right. If I take the security token generated by ZC 1.5.1 of a product, and I paste it in a form of a HTML file like this:

    Code:
    <form action="http://localhost:8888/zc15/index.php?main_page=product_info&cPath=18&products_id=910&number_of_uploads=0&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" id="cart_quantity">
    <input type="hidden" name="securityToken" value="6f64e3a15e24fa6d55e1813bc6cf99ec"></input>	
    <input type="hidden" name="id[TEXT_PREFIX9]" value="Text"></input>
    <input type="hidden" name="id[TEXT_PREFIX5]" value="_-_-_-_-_-_-_-_-_-_-"></input>
    <input type="hidden" name="id[6]" value="22"></input>
    <input type="hidden" name="id[8]" value="68"></input>
    <input type="hidden" name="id[7]" value="67"></input>
    <input type="hidden" name="cart_quantity" value="1"></input>
    <input type="hidden" name="products_id" value="910"></input>
    
    <input name="" type="submit" value="submit"></input>
    If I submit that form after pasted the security token in the same browser, ZC 1.5.1 take the product and add it to the cart perfectly.

    The problem is related to the relationship between the security token and the cookie.

  5. #5
    Join Date
    Jun 2014
    Location
    Alicante
    Posts
    15
    Plugin Contributions
    0

    Default Re: Add product to Cart URL ZC 1.5.1

    All right!

    Problem solved. I was passing more attributes to ZC 1.5.1 than the attributes the product has.

    Solution was:

    Include with the ZC 1.5.1 function
    Code:
    zen_draw_hidden_field('securityToken', $_SESSION['securityToken'])
    the value of securityToken in the form.

    Code:
    <form action="http://localhost:8888/zc15/index.php?main_page=product_info&cPath=18&products_id=910&number_of_uploads=0&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" id="cart_quantity">
    <input type="hidden" name="securityToken" value="6f64e3a15e24fa6d55e1813bc6cf99ec"></input>	
    <input type="hidden" name="id[TEXT_PREFIX9]" value="Text"></input>
    <input type="hidden" name="id[TEXT_PREFIX5]" value="_-_-_-_-_-_-_-_-_-_-"></input>
    <input type="hidden" name="cart_quantity" value="1"></input>
    <input type="hidden" name="products_id" value="910"></input>
    
    <input name="" type="submit" value="submit"></input>
    Make sure you send the correct attributes of the product.

    Think, that using the securityToken you can embed swf that send product to the cart.

    Enjoy!

    THREAT SOLVED!!
    Last edited by aire; 10 Jul 2014 at 10:10 AM. Reason: Mark as SOLVED!

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,870
    Plugin Contributions
    96

    Default Re: Add product to Cart URL ZC 1.5.1

    ... or you could have created the form using the function zen_draw_form and it would have added the hidden field for the securityToken as part of its processing.

  7. #7
    Join Date
    Jun 2014
    Location
    Alicante
    Posts
    15
    Plugin Contributions
    0

    Default Re: Add product to Cart URL ZC 1.5.1

    That's true!

    SOLVED!

  8. #8
    Join Date
    Apr 2016
    Location
    Savannah, Georgia
    Posts
    9
    Plugin Contributions
    0

    Default Re: Add product to Cart URL ZC 1.5.1

    Maybe my question does not really need a thread of it's own so here goes. I have all my videos and images in the original product id name. I need to match it all in order to automatically program to present the proper images and videos on my product_info_page. I have to make an if statement to see if the video file actually exists and if it does, substitute the produce id which is actually the model number for the file name, then elseif make a statement about no video available if none exists.

    How can I get the original product id and put it into, for example, my video code. What variable can I put where I have 'VariableHere in this example? How do I set it up? I use to write perl code but this is a little different. (I had a dollarsign in my little demo here but decided I had better remove it before posting)

    <video controls="controls">
    <source src="videos/h264/VariableHere.mp4" type="video/mp4">
    <source src="videos/webm/VariableHere.webm" type="video/webm">
    <source src="movie.ogg" type="videos/ogg/VariableHere.ogg">
    Your browser does not support the video tag.
    </video>

    Any help will be greatly appreciated.

  9. #9
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,870
    Plugin Contributions
    96

    Default Re: Add product to Cart URL ZC 1.5.1

    Quote Originally Posted by bushpilot444 View Post
    Maybe my question does not really need a thread of it's own so here goes. I have all my videos and images in the original product id name. I need to match it all in order to automatically program to present the proper images and videos on my product_info_page. I have to make an if statement to see if the video file actually exists and if it does, substitute the produce id which is actually the model number for the file name, then elseif make a statement about no video available if none exists.

    How can I get the original product id and put it into, for example, my video code. What variable can I put where I have 'VariableHere in this example? How do I set it up? I use to write perl code but this is a little different. (I had a dollarsign in my little demo here but decided I had better remove it before posting)

    <video controls="controls">
    <source src="videos/h264/VariableHere.mp4" type="video/mp4">
    <source src="videos/webm/VariableHere.webm" type="video/webm">
    <source src="movie.ogg" type="videos/ogg/VariableHere.ogg">
    Your browser does not support the video tag.
    </video>

    Any help will be greatly appreciated.
    You could try delia's Product Extra Fields plugin. That updates your database and the admin-console product-edit page to provide data-entry for various files (and one text-block) that are associated with each product and provides the display/link to those files when the product's product_info page is rendered.

  10. #10
    Join Date
    Apr 2016
    Location
    Savannah, Georgia
    Posts
    9
    Plugin Contributions
    0

    Default Re: Add product to Cart URL ZC 1.5.1

    I figured out. I have no idea what the 'correct' way to do this might be, but I have it working just like I wanted with the following;

    PHP Code:
                          <section id="section-2">
                        
                    
    <?php $videofile="$products_model"?>                
    <?php $videopath="videos/cc-content/uploads/h264/$videofile.mp4"?>
    <?php 
    if( file_exists($videopath)){  ?>
                
            <div align="center"><strong><b><i>IndependentAgain.Co Product Videos</i></b></strong></div>
    <!--bof Product videos -->
    <div align="center">*** Product Demonstration ***</div>
    <!--bof Product Name-->
    <div align="center"><h4><b><?php echo $products_name?></b></h4></div>
    <!--eof Product Name-->

    <div align="left"><video controls="controls" width="100%" height="auto" preload poster="images/video_images/<?php echo (($products_model !='') ? '' $products_model '' '') . ""?>.jpg">>
      <source src="videos/cc-content/uploads/h264/<?php echo (($products_model !='') ? '' $products_model '' '') . ""?>.mp4" type="video/mp4">
      <source src="videos/cc-content/uploads/webm/<?php echo (($products_model !='') ? '' $products_model '' '') . ""?>.webm" type="video/webm">
      <source src="movie.ogg" type="videos/cc-content/uploads/ogg/<?php echo (($products_model !='') ? '' $products_model '' '') . ""?>.ogv">
      Sorry, your browser does not support the video tag.
    </video></div>

    <?php }else{ ?>
      
            <div align="left"><strong><b><i>Sorry, no videos are available for this product, however, now might be a great time to learn more about the company that manufactures  most of our products.</div><br><div align="center">Introducing Drive DeVilbiss Healthcare</i></b></div><br><div align="left">Drive DeVilbiss Healthcare is one of the fastest growing major manufacturers and distributors of durable medical equipment in the home healthcare, medical/surgical and rehabilitation markets in the United States. We have manufacturing and distribution facilities located throughout the United States, as well as in the United Kingdom, Germany, China, Taiwan, Romania and Canada, and market thousands of products throughout the world. We focus on innovation, functionality, and value to promote independence for the individuals that use our products. Drive DeVilbiss Healthcare exists to enhance the quality of life of the people we touch. Please, watch our video below to learn more about our innovative company.</strong><p></div>

    <!--bof Product videos -->
    <div align="left"><video controls="controls" preload width="100%" height="auto" poster="images/video_images/drivemedical.jpg">
    <source src="videos/cc-content/uploads/h264/drivemedical.mp4" type='video/mp4'>
    <source src="videos/cc-content/uploads/webm/drivemedical.webm" type='video/webm' >
    <source src="videos/cc-content/uploads/ogg/drivemedical.ogv" type='video/ogg; codecs="theora, vorbis"'/>
    <p>Video is not visible, most likely your browser does not support HTML5 video</p>
    </video>
    </div>

    <?php ?>    

    <!--eof Product videos -->
                    </section>

 

 

Similar Threads

  1. Replies: 1
    Last Post: 14 Jan 2013, 03:43 AM
  2. Attribute add to cart url
    By Endre in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 26 Oct 2009, 03:16 PM
  3. Add a return URL to add to cart
    By directpc in forum General Questions
    Replies: 9
    Last Post: 31 Oct 2007, 07:14 PM
  4. Products URL and Add to Cart
    By digidiva-kathy in forum General Questions
    Replies: 2
    Last Post: 18 Sep 2007, 02:50 PM
  5. Add Product to Cart URL
    By Webbo1969 in forum Customization from the Admin
    Replies: 24
    Last Post: 27 Mar 2007, 01:38 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