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

New Field in product page

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 05-27-2014, 02:34 AM
 
Kannan Kannan is offline
 

Senior Member
  
Join Date: Apr 2008
Posts: 116
 

Default New Field in product page

Hi,

How to create the new field in "xc_products" table?
Also field should reflect in the invoice page.
__________________
4.6.6
- SNK
Reply With Quote
  #2  
Old 05-27-2014, 03:04 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: New Field in product page

Hi!

The main process is as follows:
1) Create an empty module as described here: http://kb.x-cart.com/display/XDD/How+to+create+a+module
2) Create the file Model/Product.php script inside your module with the following content:
PHP Code:
<?php

namespace <YOUR-NAME-SPACE>;

class 
Product extends \XLite\Model\Product implements \XLite\Base\IDecorator
{
    
/**
      * @Column(type="integer")
      */
    
protected $my_int_property;

    
/**
      * @Column(type="string", length="32")
      */
    
protected $my_string_propery;
}

You should use your own namespace in the script, of course. Within the example, I created two properties: integer property and string one.

Once you rebuild cache X-Cart 5 will update tables and new field will appear in the database.

If you can give more details about how you want to display on invoice, I can help you with this part as well.

Tony.
Reply With Quote

The following 2 users thank tony_sologubov for this useful post:
qualiteam (05-28-2014), totaltec (05-27-2014)
  #3  
Old 05-27-2014, 06:59 AM
 
Kannan Kannan is offline
 

Senior Member
  
Join Date: Apr 2008
Posts: 116
 

Default Re: New Field in product page

Hi,

Thanks. Its working. New field added in product table. We want to show that "added field value" in the invoice below the product name. Can you advice us.

Thanks in advance
__________________
4.6.6
- SNK
Reply With Quote
  #4  
Old 05-28-2014, 04:41 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: New Field in product page

Hi Kannan!

I will provide code sample within next two days.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 06-02-2014, 05:56 AM
 
xcartwarrior xcartwarrior is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 40
 

Default Re: New Field in product page

Hi,

Thanks. Now we added the field in invoice pages and its working. Can you advice how to show the categories and subcategories in Top menu bar like flyout menu.

Thanks in advance.
__________________
Regards
Hari
www.xcartwarrior.com
Post your queries to support@xcartwarrior.com
Special X-Cart Support & Maintenance services
Reply With Quote
  #6  
Old 06-03-2014, 01:44 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: New Field in product page

Hi!

First of all, you should check the last webinar doc for more details.

This section describes how you can replace menu items with your own ones:
http://kb.x-cart.com/pages/viewpage.action?pageId=7504837#Webinar2-10Apr2014-DesignchangesinX-Cart5(Custom...thmyownme nu?

Please, let me know if it helps.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #7  
Old 12-16-2014, 12:10 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: New Field in product page

I have just written an article about how to accomplish task. Hopefully, it will help anybody:
http://kb.x-cart.com/display/XDD/Adding+new+property+to+product
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
cflsystems (12-16-2014)
  #8  
Old 05-12-2015, 07:12 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: New Field in product page

Based on your guide I was trying to add a product property and display it on my product page. I had no problem creating the field and storing a value in the xc product table, but when I tried to make add my .tpl so it would display on the product page I kept getting a Call to a member function get() on a non-object error. Any idea what I'm doing wrong here?
__________________
Ver 5.2.6
Reply With Quote
  #9  
Old 05-20-2015, 12:49 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: New Field in product page

Hello Phil,

How do you display your template on the product page?

For each template file there is a PHP class that provides getSomething() methods to that template. If you do not specify such a class, it uses the class selected for the "parent" template file.

So, it looks like you display your template inside another template that doesn't have the necessary method (used in your template).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #10  
Old 05-27-2015, 10:53 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: New Field in product page

Hello Phil,

Could you post the code of your template here?

Thank you.

Tony

Quote:
Originally Posted by Phil Richman
Based on your guide I was trying to add a product property and display it on my product page. I had no problem creating the field and storing a value in the xc product table, but when I tried to make add my .tpl so it would display on the product page I kept getting a Call to a member function get() on a non-object error. Any idea what I'm doing wrong here?
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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 10:08 AM.

   

 
X-Cart forums © 2001-2020