Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding/Modifying Fields in the Main Product Table

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 07-29-2008, 05:37 AM
 
dgreen dgreen is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 85
 

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

how can I add my new field to the simple and advanced searches?

does anyone have any ideas?
__________________
X-Cart version 4.1.10
upgraded from 4.0.13 myself slowly and with help from xcart forums. Thanks all!

http://www.discountseforim.com
Hebrew Seforim and Jewish Books
Reply With Quote
  #12  
Old 10-01-2008, 09:21 AM
 
carpart4u carpart4u is offline
 

Newbie
  
Join Date: Jun 2008
Posts: 6
 

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}

Hi Phil,

I can add a custom field successfully.
When i try to import cvs database...
I got error messages:
Quote:
An error occurred during the verification of the CSV file. Please check your CSV file and fix the problem, then try again.

Date: 01-Oct-2008 10:19:14
Launched by: master

Error on line 2: Column 'BIN_LOCATION' is not supposed to be in the section 'PRODUCTS' (PRODUCTS):
!PRODUCTID;!PRODUCTCODE;!BIN_LOCATION

if that's not supposed to be in the section 'PRODUCTS', which section should I use? THANKS
__________________
Version 4.1.10
Reply With Quote
  #13  
Old 03-28-2009, 02:46 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

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

I want to add some more fields like Pack Size & Attribute in a small text field and also the content type=Liquid,Solid etc.... in a select box in the product item card.Also I want to import that field values via 3x-4x import. How can I able to do that?Kindly help me to do this.

Thanks to all again.
__________________
4.6.1 Platinum


Reply With Quote
  #14  
Old 04-07-2009, 02:23 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 ...
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 such effort.But can you help me where to add {$product.artist} in
(skin1/customer/main/product.tpl) file?
__________________
4.6.1 Platinum


Reply With Quote
  #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
  #16  
Old 06-18-2009, 10:37 PM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

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

Hi,
May I request some help from the Forum please?

I am here --- >

Thanks in advance...
__________________
4.6.1 Platinum


Reply With Quote
  #17  
Old 07-08-2009, 10:29 PM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

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

Any response from forum please!!! I really need some help.

Thanks to all.
__________________
4.6.1 Platinum


Reply With Quote
  #18  
Old 07-08-2009, 11:12 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

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

Thank you PhilJ. People are affraid X-Cart because there are no information how to change the code. If QT will take in consideration to write a developer manual, it will be much easier for everyone to go on their own.
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #19  
Old 07-08-2009, 11:44 PM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

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

Hi am2003,
Can you help me a little bit !!!

Thanks to all.
__________________
4.6.1 Platinum


Reply With Quote
  #20  
Old 07-16-2009, 04:55 AM
 
Mathieu-911 Mathieu-911 is offline
 

Newbie
  
Join Date: Jun 2009
Posts: 1
 

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

Hello!
I'm new with x-cart.
I have try to add one field fallowing the steps you've writen. The data is displayed well but no modification to the data is reported to DataBase. What's wrong ?

To DataBase:
ALTER TABLE `xcart_products` ADD `descrauteurs` TEXT DEFAULT NULL;

in product_modify.php, i added: "descrauteurs" => $descrauteurs at the wright place
and in product_details.tpl, i added:
<tr>
{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[descrauteurs]" /></td>{/if}
<td class="FormButton" nowrap="nowrap">{$lng.lbl_descrauteurs}* :</td>
<td class="ProductDetails">
{include file="main/textarea.tpl" name="descrauteurs" cols=45 rows=12 class="InputWidth" data=$product.descrauteurs width="80%" btn_rows=4}
</td>
</tr>

What's the problem ????
Tanks for your help.
__________________
* your current X-Cart/LiteCommerce version number
* add-on modules you have

You can find your X-Cart/LiteCommerce version by viewing www.yourstore.com/xcartdir/VERSION
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:13 PM.

   

 
X-Cart forums © 2001-2020