View Single Post
  #15  
Old 04-09-2009, 04:39 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Adding/Modifying Fields in the Main Product Table

Quote:
Originally Posted by PhilJ
OK, here's how it's done in v4.1.x ...
1) Add a new product text field called 'artist'...
Patch the database...
Code:
ALTER TABLE `xcart_products` ADD `artist` TEXT NOT NULL ;
2) include/product_modify.php
Look for...
Code:
# Update product data
Within...
Code:
$query_data = array( ... );
Along similar lines add...
Code:
"artist" => $artist,
3) skin1/main/product_details.tpl
Add this code in a suitable place...
Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[artist]" /></td>{/if} <td class="FormButton" nowrap="nowrap">Artist</td> <td class="ProductDetails"><input type="text" name="artist" size="18" value="{if $product.productid eq ""}{else}{$product.artist}{/if}" /></td> </tr>
Or for predefined options...
Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[artist]" /></td>{/if} <td class="FormButton" nowrap="nowrap">Artist</td> <td class="ProductDetails"> <select name="artist"> <option value=""{if $product.artist eq ""} selected{/if}>None</option> <option value="Van Gogh"{if $product.artist eq "Van Gogh"} selected{/if}>Van Gogh</option> <option value="Picasso"{if $product.artist eq "Picasso"} selected{/if}>Picasso</option> </select> </td> </tr>
That's it!
To use the field on your product page, (skin1/customer/main/product.tpl), use this code...
Code:
{$product.artist}
To use the field on your products page, (skin1/customer/main/products.tpl or products_t.tpl), use this code...
Code:
{$products[product].artist}

Thanks PhilJ for those fine codes.But I can not know where to add {$products[product].artist} in (skin1/customer/main/product.tpl) file?Can you guide me?

Also is it possible to import from 3x-4x import?

Thanks to all.
__________________
4.6.1 Platinum


Reply With Quote