View Single Post
  #7  
Old 06-12-2004, 07:37 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Well my code above was a complete mess but I got it working now.

To add a checkbox field to the xcart_products table and have it updateable in the admin here we go (3.5.7)

Edit skin1/main/product_modify.tpl and add

Code:
<TR> <TD class=ProductDetails height="11">{$lng.lbl_discontinued}</TD> <TD class=ProductDetails height="11"> <INPUT type=checkbox name=discontinued value="N" {if $product.discontinued eq "Y"}checked{/if}> </TD> </TR>

where you want it to appear, I added it after the </tr> for discount avail. You will need to create a language label tag (in my example I am using discontinued) to identify what the checkbox is for {$lng.lbl_discontinued}.

Be sure to add a field to the end of your xcart_products database table.

The attributes should be

Quote:
Field name (whatever you want), CHAR, 1, Not Null, and in my case default should = N.

Lastly you need to modify include/product_modify.php

Change this area

Code:
# # Update product data # db_query("update $sql_tbl[products] set product='$product', categoryid='$categoryid', categoryid1='$categoryid1', categoryid2='$categoryid2', categoryid3='$categoryid3', brand='$brand', model='$model', descr='$descr', fulldescr='$fulldescr', avail='$avail', list_price='$list_price', weight='$weight', productcode='$productcode', forsale='$forsale', distribution='$distribution', free_shipping='$free_shipping', shipping_freight='$shipping_freight', discount_avail='$discount_avail', min_amount='$min_amount', param00='$param00', param01='$param01', param02='$param02', param03='$param03', param04='$param04', param05='$param05', param06='$param06', param07='$param07', param08='$param08', param09='$param09', low_avail_limit='$low_avail_limit', $apply_vat free_tax='$free_tax' $apply_canadian_taxes where productid='$productid'");

to

Code:
# # Update product data # db_query("update $sql_tbl[products] set product='$product', categoryid='$categoryid', categoryid1='$categoryid1', categoryid2='$categoryid2', categoryid3='$categoryid3', brand='$brand', model='$model', descr='$descr', fulldescr='$fulldescr', avail='$avail', list_price='$list_price', weight='$weight', productcode='$productcode', forsale='$forsale', distribution='$distribution', free_shipping='$free_shipping', shipping_freight='$shipping_freight', discount_avail='$discount_avail', min_amount='$min_amount', param00='$param00', param01='$param01', param02='$param02', param03='$param03', param04='$param04', param05='$param05', param06='$param06', param07='$param07', param08='$param08', param09='$param09', low_avail_limit='$low_avail_limit', discontinued='$discontinued', $apply_vat free_tax='$free_tax' $apply_canadian_taxes where productid='$productid'");

You'll notice that everywhere in the above I am using discontinued. This is the name of the field I wanted to add and should make it easy for you to find all of my changes.

Thanks to BCSE and Telafirma for lending their ears.

Can we get this added to Custom mods? I spent two hour looking for this information before starting this thread.

Keywords: insert checkbox, insert field, add field, product modify
Reply With Quote