Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

FORCING option selection?


Recommended Posts

im trying to FORCE a person to make a choice for options... so i created an option, for example, that says "PLEASE SELECT COLOR" which is listed first in the dropdown list when you are viewing product_info.php


in the product_info.php form, this attribute's select item is named "id[1]"


in application_top there is switch ( $HTTP_GET_VARS['action'] ) that handles input from product_info.php passed by the "action=" in the url


in the add_product action case around line 30 or something (for when "action=add_product"), i want to put a conditional test in that checks the id[1] value using if ($HTTP_POST_VARS['id[1]'] == "2")


and if the option IS the "PLEASE SELECT" option, it will throw up a javascript alert window and then break; the case.


however, its not breaking properly. its not breaking at all. it adds the item just like it normally would. anyone have any suggestions? the code can be viewed here:




am i not using the correct httpvars?

Link to comment
Share on other sites

The Shoppe Enhancement Controller v1.0 that I am about to release has this feature built in.


You can make an attribute a Display Only attribute and if the customer selects that, it will warn them in the Shopping Cart and they cannot check out until they select the proper choices.


You can see the Shoppe Enhancement Controller v1.0 at:




Try both the Catalog and Admin, then test it out if you like.

Link to comment
Share on other sites

how far along are you? ive been trying to get this to work for a couple of days now and the boss is getting more and more angry ;(


if it's something that is going to still be weeks in development, ill unfortunately have to continue muddling my way through this :|

Link to comment
Share on other sites

I don't like to assume based on stats as many times you can miss the reason that 99% use MSIE but only 3% buy where 37% use NS but 20% buy.


Just like you get 5000 hits a day ...

The bulk of sales are DSL connections ...

... But the bulk of visitors stay for 30secs or less. Why?


Your pages are dogs ... your images to big ... and no one wants to wait.


So you are losing a bulk of sales because you miss read the stats.


But, I diegress ...


Test this out and see what you think ... it should be released in the next 24-48 hours.

Link to comment
Share on other sites

oh, no, i agree completely. however this project is basically up against the fence, so to speak, when it comes to a timeframe. i figured that a quick javascript hack could prevent people from being able to add an item to the cart in the event that they didnt see the option dropdown.


the products that we sell go for thousands of dollars... nothing like shirts or movies or anything... so its REALLY important that the person pick out what they want, and that they pick it out correctly, because it could be a matter of weeks if things get messed up, not to mention the cost of shipping per (rather large) item for returns and stuff.


thank you for your quick response earlier, by the way :)

Link to comment
Share on other sites

well, ideally the less human interaction the better. we take too many orders and have too many global distributors and dealers to call back each and every individual customer to ensure that they really meant to purchase the spa. besides, when you are trying to sell stuff, the last thing you want to do is call someone and ask them "are you sure you really want to spend this much money on a luxury item?" we want to make the purchase as... "correct" as possible, meaning the person MUST be aware that there are electrical requirements for some of our products as well as color options, etc. THEN, when they get the product that they wanted (with the correct color, etc.) and if they decide they would like to return it or whatever, they can. but the idea is to get the orders out the door as quickly as possible without error. i'm not a salesperson, but common sense tells me that the easier it is to buy, the shorter the buying process, the more failsafe it is (i.e. FORCED option selection), etc.,... the more sales you would have.


our current shopping cart has encryption problems with storing credit card numbers in the databawse, and almost 3 out of every 5 numbers is garbled. these customers we DO have to call back, and let me tell you how much of a pain it is!! :( i've tried to fix the problem several different ways, but since we're launching a new site i decided that we should go with OSC for a cart system. so, with the website about to launch and my bosses changing their minds about what they want every 15 minutes, it's imperative that i get a cart working to their exact specifications as soon as possible, as this project has already taken WAY too long (and dammit, it's not my fault!)

Link to comment
Share on other sites

First, you can't " throw up a javascript alert window" in the middle of application_top.php. you'll get header errors. you'll have to redirect back to the product page or set a message to be displayed in the shopping cart or something.


Second, the link you posted shows no code.


Third, use $HTTP_POST_VARS['id'][1]

Link to comment
Share on other sites

1) oh, i had assumed that if i used an alert window and broke the case, that it would continue loading the page without running the 'add to cart' code (you know how when you add an item to the cart, it redirects to the shopping cart contents page? i thought i could use a conditional to skip this and have it display a javascript alert and then just finish "re"loading the product info page without redirecting to the cart contents page).


2) pastebin.com must have shortened the time that snippets are accessible :(


3) ah, i see! thank you for the clarification :D


thank you for your help!!

Link to comment
Share on other sites

you can't output anything in application_top.php


before the switch ($HTTP_GET_VARS['action'])

you can try something like this...

if($HTTP_POST_VARS['id'][1] == 2) {

 $HTTP_GET_VARS['action'] = '';

 $message = "You did not choose a color, dummy.";


it should just bypass the switch. then in the body of product_info check if $message is set, and display it.

or you could try <body onload="alert('<?=$message;?>')">, but triggering the onload to only run in this case could be tricky.

Link to comment
Share on other sites

yah, i had already done the isset but i didnt use it to print a body tag, i just stuck it right below the body. yours is a better idea, thanks. :D


however now im stuck with another problem. i cant figure out why my attributes are displaying in random order. ive removed them all, readded them all, even gone so far as to change the attribute id numbers and option numbers in the dbase itself to try to get them to display properly in the order. they seem alphabetical for the most part (which is how i added them) however the default displayed item is always one of the middle items (Navy Blue, for example), and the "Please Select a Color" option is someplace in the middle as well (usually not in alphabetical order). Any clue on how to force OSC to display options in a certain order? Changing the sort method in the admin area from ID to Name only sorts it for the admin area, I would assume... to make it easier on the cart admin if there are lots of attributes to sort through. i guess ill have to find a contribution that lets you order and manage the attributes. i think i saw one of those on Ajeh's site, so i'll look it up.

Link to comment
Share on other sites

yes, Linda McGrath's

Attribute Copier and Sorter



or, if you're attributes truly are alphabetical, you can change the "order by" clause in the sql in product_info.php

and use this to add a "Please Select" default option


Link to comment
Share on other sites

If you read the forums enough and pay attention you can learn pretty much everything :) We have very intelligent people hanging around here.




And I still think that people spending as much as it sounds like they are on your products would like the "human touch".

[no external urls in signatures please, kthanks]

Link to comment
Share on other sites

oh no, don't get me wrong, i work with one of the best and most people-friendly staff i've ever seen, and we do a lot of our sales in our show room, at dealerships, and on the phone. the way my boss sees it, the internet people who want the human touch will wind up on the phone eventually anyways, so why not just let them call instead of making them submit (basically) a request to have someone call them back. it's one less step for those people to wait through, and that leaves only the internet shoppers who don't want or need the human touch. this ensures that the system (in the order of importance): keeps all parties happy, generates revenue, and (for the most part) runs itself.


hope that makes sense. and i hope you don't think this is a sales pitch for my company :P i'd never mention the name of it here i don't think. just don't want anyone having the wrong impression ;(

Link to comment
Share on other sites


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

  • Create New...