Results 1 to 6 of 6
  1. #1

    Default Creating a Form to Help Customers Choose Products

    I am trying to create a form that will help my customers choose products to buy. So, I created a simple form in HTML and had the variables post to a PHP file. The PHP file is filled with a bunch of if-statements and echoes the products that they should buy based on the responses provided on the form. It all works nicely!

    But, integrating it into Zen Cart is giving me fits. I have two problems:

    1) I can add the form using EZ-PAGES. I can add the PHP script by adding another define page. But, I can't get the variables to pass from the EZ-PAGE form to the Define Page PHP Script. They pass fine when I use the same code outside of Zen Cart.

    2) I would like to present some product choices based on the form they filled out and then give customers the option to add these products to their cart. I can figure out how to add one product to a cart: just link to /index.php?main_page=index&action=buy_now&products_id=(PRODUCT_ID HERE)
    But, I can't figure out how to do this with multiple products. I'd like to provide checkboxes next to each product, and if they are checked, they will get added to their cart when clicking a submit button.

    Any help would be greatly appreciated!

    Thanks!

  2. #2
    Join Date
    Nov 2007
    Posts
    260
    Plugin Contributions
    0

    Default Re: Creating a Form to Help Customers Choose Products

    Quote Originally Posted by srturner47 View Post
    I am trying to create a form that will help my customers choose products to buy. So, I created a simple form in HTML and had the variables post to a PHP file. The PHP file is filled with a bunch of if-statements and echoes the products that they should buy based on the responses provided on the form. It all works nicely!

    But, integrating it into Zen Cart is giving me fits. I have two problems:

    1) I can add the form using EZ-PAGES. I can add the PHP script by adding another define page. But, I can't get the variables to pass from the EZ-PAGE form to the Define Page PHP Script. They pass fine when I use the same code outside of Zen Cart.
    Maybe explaining more in detail may it is easier for ppl here to help.


    Quote Originally Posted by srturner47 View Post
    2) I would like to present some product choices based on the form they filled out and then give customers the option to add these products to their cart. I can figure out how to add one product to a cart: just link to /index.php?main_page=index&action=buy_now&products_id=(PRODUCT_ID HERE)
    But, I can't figure out how to do this with multiple products. I'd like to provide checkboxes next to each product, and if they are checked, they will get added to their cart when clicking a submit button.

    Any help would be greatly appreciated!

    Thanks!
    Zen Cart product list page displayes feature where several product order pcs values can be edited and put to cart all at once. You need to check out the code how it works.
    Note if products have price attributes then this feature is not displayed.

    I have column_layout_grid_v_1_3_6 module installed, but i presume that feature exist even without it.

    marksu

  3. #3

    Default Re: Creating a Form to Help Customers Choose Products

    Thanks for the help! I actually did what you suggested and it worked nicely. But, I wasn't able to solve the problem with the variables passing to an EZ Page. I really don't know how to describe this any better, sorry. I just want variables that a user selects to pass to an EZ-Page. Anyway, I had to make my page look like it was in Zen Cart, even though it is really not to pass the variable. While I am really happy with the result, it is not a permanent solution. First of all, any changes I make to the site won't be reflected since its not really in Zen Cart. Secondly, I can't get dynamic stuff to work like the Checkout and My Account Link without actually having the page in Zen Cart. So, any help on passing variables to another page would still be appreciated!

    Here is the end result; I think it is pretty slick, although a little jerry-rigged:

    http://birdingdepot.com/index.php?main_page=page&id=20

  4. #4

    Default Re: Creating a Form to Help Customers Choose Products

    OK. I've made some progress. I figured out that EZ-Pages don't work with PHP, but Define Pages do. So what I would need to do is create a new define page. For the time being, I am using one of my old define pages to test this out.

    I see a couple reasons that I might be having a problem, but I have no idea how to solve them. I noticed that the actual webpage is "index.php" and that the define page is called by a method="get" variable, so my web page look like this:

    /index.php?main_page=about_us

    So, I tried changing from method="post" to method="get". It passed the variables through the html link, but overrides the about_us. This could be easily solved by adding a main_page variable and assigning it "about_us", but I tried creating my own link, and it still does work. Here is what I tried:

    /index.php?main_page=about_us&mount=2&top=6&hook=2&water=1&submit=Create+My+Custo mized+Pole+System

    Still doesn't work.

    Is the problem that index.php gets the variables and doesn't pass them on to the PHP code in my define page? Is there a way to get around this? Any advice would be greatly appreciated!

  5. #5
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Creating a Form to Help Customers Choose Products

    EZ-Pages don't work with PHP
    Yes they will if you read instructions at url below
    http://www.zen-cart.com/forum/showth...es+include+php

  6. #6

    Default Re: Creating a Form to Help Customers Choose Products

    Yeah, I found that thread. It sounds interesting, but why not just create a new define page? Plus, it sounds like there are some security risks in doing so.

    Anyway, I'm still stuck trying to figure out how to pass variables to a PHP script in Zen Cart whether or not I am using a Define Page or an EZ-Page.

 

 

Similar Threads

  1. v150 Help creating distributor application form
    By dfontana in forum General Questions
    Replies: 8
    Last Post: 22 Sep 2012, 06:36 PM
  2. Help: Creating Simple Form to Post to New DB Table
    By shakes222 in forum General Questions
    Replies: 2
    Last Post: 14 Dec 2010, 11:04 PM
  3. Creating form to collect data for Personalized Products
    By twofairfield in forum General Questions
    Replies: 3
    Last Post: 7 May 2010, 09:55 PM
  4. Force Customers to Choose a Size
    By karenkte in forum General Questions
    Replies: 1
    Last Post: 28 May 2008, 12:40 PM
  5. Customers choose the price, is it possible
    By Thierry13 in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 24 Nov 2007, 03:54 PM

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