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

Add Extra field to "Add new product" Page!

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-07-2007, 03:57 AM
 
Saman Saman is offline
 

Member
  
Join Date: Nov 2007
Location: London
Posts: 28
 

Post Add Extra field to "Add new product" Page!

Hi
I would like to have an extra field (not visible to the clients) such as the cost price.
I have added the extra field (Cost price) into the "Add new product " page, by adding the code below to the "product_details.tpl". also i added the field into the database "xcart_products" table.

Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[cost_price]" /></td>{/if} <td class="FormButton" nowrap="nowrap">{$lng.lbl_cost_price} <span class="Text">({$config.General.currency_symbol})</span></td> <td class="ProductDetails"><input type="text" name="cost_price" size="18" value="{$product.cost_price|formatprice|default:$zero}" /></td> </tr>

The problem is the new extra field (cost price) can show the data from the database (if i add it manually into the database by phpMyAdmin), but I can not modify or add it from the form itself.

Can any one please tell me what i am missing here? Do i need to modify any PHP file as well? and where i can find the ($product) variable?

Thank you

PS. I know how to add normal extra fields which they will be visible to the customers.
__________________
Saman
-------------------
Having:
X-Cart 4.1.9
X-RMA
X-Special Offers
X-Survey
Reply With Quote
  #2  
Old 12-07-2007, 04:01 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Add Extra field to "Add new product" Page!

In /include/product_modify.php search for...
Code:
# Update product data
Find the line...
Code:
"free_tax" => $free_tax,
Below, add this code...
Code:
"cost_price" => $cost_price,
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 12-07-2007, 04:02 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Add Extra field to "Add new product" Page!

Saman, you can use regular extra fields for this, just uncheck the 'visible' box next to them to keep them from showing on the customer side.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 12-07-2007, 04:06 AM
 
Saman Saman is offline
 

Member
  
Join Date: Nov 2007
Location: London
Posts: 28
 

Default Re: Add Extra field to "Add new product" Page!

Thank you guys,
__________________
Saman
-------------------
Having:
X-Cart 4.1.9
X-RMA
X-Special Offers
X-Survey
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 01:57 PM.

   

 
X-Cart forums © 2001-2020