View Full Version : dynamic select boxes not appearing in cart

05-19-2009, 10:04 PM
I'm currently using the following javascript:

function dynamicSelect(id1, id2) {
if (document.getElementById && document.getElementsByTagName) {
var sel1 = document.getElementById(id1);
var sel2 = document.getElementById(id2);
var clone = sel2.cloneNode(true);
var clonedOptions = clone.getElementsByTagName("option");
refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
sel1.onchange = function() {
refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) {
while (sel2.options.length) {
var pattern1 = /( |^)(select)( |$)/;
var pattern2 = new RegExp("( |^)(" +
sel1.options[sel1.selectedIndex].value + ")( |$)");
for (var i = 0; i < clonedOptions.length; i++) {
if (clonedOptions[i].className.match(pattern1) ||
clonedOptions[i].className.match(pattern2)) {
window.onload = function() {
dynamicSelect("pda-brand", "pda-type");

The catch: I'm using this code in my shopify e-commerce site theme.liquid. In order to get my product pages to work with it, my select boxes are set up on each product page. They are functioning up to this point. (I can pick a color or size and click my add to cart button and get to the cart with the item in my cart). My problem is that I can not get the selections that are made with the boxes to show up in the shopping cart for the customer (and myself). I have tried many different combinations to get the code to show up but i'm stumped. Here is my cart.liquid code:

<h2>Your Shopping Cart</h2>
{% if cart.item_count == 0 %}
<h3>Your cart is empty</h3>
<p><a href="/"><img src="{{ 'continueshopping.gif' | asset_url }}" alt="continue shopping" /></a></p>
{% else %}
<form action="/cart" method="post" id="cartform" name="cartform">
{% for item in cart.items %}
<div id="shoppingcart">
<div class="shoppingcart-image"> <img src="{{ item.product.images.first | product_img_url: 'medium' }}" alt="{{ item.title | escape }}" /> </div>
<h3><a href="{{ item.product.url }}">{{ item.title }}</a><br />
{{ item.product.description | strip_html | truncate: 50 }}<br />
{{ item.sku }}<br />
I need the box selections to show up here (hopefully)
{{ item.price | money }}</h3>
<div class="updater">
<input type="text" name="updates[]" value="{{ item.quantity }}" onfocus="this.select();" class="cart-update" />
<input type="submit" name="update" value="Update" id="update-cart">
<br />
<br />
<a href="/cart/change/{{ item.variant.id }}?quantity=0">Remove from cart</a> </div>
{% endfor %}
<div class="total">SUBTOTAL: {{ cart.total_price | money }} {{ shop.currency }}</div>
<div class="checkout">
<a href="/"><img src="{{ 'continueshopping.gif' | asset_url }}" alt="continue shopping" /></a>
<input type="image" value="Proceed to Checkout" name="checkout" src="{{ 'checkout.gif' | asset_url }}"/>
{% endif %}

Is anyone possibly able to help me? so far I have not only looked in the shopify wiki, but also asked on the the forum and a couple of other forums...but I still have yet to find the answer. I want to thank anyone who reads this...your time is appreciated.