Zen Cart Logo
Forums / General Questions / Creating a Form to Help Customers Choose Products

Creating a Form to Help Customers Choose Products

Locked

Views: 1,507

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
17 Jan 2008, 3:19 AM
#1
srturner47 avatar

srturner47

Zen Follower

Join Date:
Oct 2007
Posts:
385
Plugin Contributions:
0

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!

26 Jan 2008, 4:37 PM
#2
marksu avatar

marksu

Zen Follower

Join Date:
Nov 2007
Posts:
260
Plugin Contributions:
0

Re: Creating a Form to Help Customers Choose Products

srturner47:

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.

srturner47:

  1. 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

9 Feb 2008, 8:26 AM
#3
srturner47 avatar

srturner47

Zen Follower

Join Date:
Oct 2007
Posts:
385
Plugin Contributions:
0

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

9 Feb 2008, 7:08 PM
#4
srturner47 avatar

srturner47

Zen Follower

Join Date:
Oct 2007
Posts:
385
Plugin Contributions:
0

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+Customized+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!

13 Feb 2008, 1:46 AM
#6
srturner47 avatar

srturner47

Zen Follower

Join Date:
Oct 2007
Posts:
385
Plugin Contributions:
0

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. :frusty: