I have a one page website that has 1 product with color variations of the product i.e. Black, Pink, etc. I created a Products template that is cloneable, since each product option needs it's own unique SKU. How can I access the different "variables" for each product created to repeat in a select dropdown? Or is there a better way to structure adding products to the CMS?
Current Code (Hard Coded):
The Clonable template:
I need the option value to update with the related variables in the CMS for the shopping cart, as well as the price.
Current Code (Hard Coded):
- Code: Select all
<cms:pages masterpage='products.php'>
<form action="https://XXX.foxycart.com/cart" method="post" accept-charset="utf-8">
<input type="hidden" name="name" value="Cool Example" />
<input type="hidden" name="price" value="10" />
<input type="hidden" name="code" value="sku123" />
Only <sup>$</sup><span class="dark">79.99</span>
<div class="gap-20"></div>
<select>
<option value="">Onyx</option>
<option value="">Bubble Gum Pink</option>
<option value="">Luscious Leopard</option>
</select>
<a class="order-button" href="#"><cms:show button_text /></a>
</form>
</cms:pages>
The Clonable template:
- Code: Select all
<?php require_once( 'cms/cms.php' ); ?>
<cms:template title='Products' clonable='1' order='7'>
<cms:editable name='product_name' label='Product Name' required='1' type='text' order='1'/>
<cms:editable name='product_price' label='Price' desc='Use format 79.99' required='1' type='text' order='2'/>
<cms:editable name='product_sku' label='SKU' desc='Must be unique for each product' required='1' type='text' order='3'/>
<cms:editable name='product_weight' label='Weight' desc='in pounds' required='1' type='text' order='4'/>
<cms:editable name='product_fc_category' label='FoxyCart Category' opt_values='ResQ Bag=ResQ_Bag || Mini ResQ Bag=Mini_ResQ_Bag' type='dropdown' order='5'/>
<cms:editable name='product_image' label='Product Image' desc='Image will be automatically resized if bigger than 496x365px' quality='100' width='482' height='384' crop='1' show_preview='1' type='image' order='6'/>
<cms:editable name='product_image_thumb' label='Product Image Thumbnail' desc='Thumbnail of product image' crop='1' width='160' height='159' show_preview='1' assoc_field='product_image' type='thumbnail' order='7' />
</cms:template>
<?php COUCH::invoke(); ?>
I need the option value to update with the related variables in the CMS for the shopping cart, as well as the price.