View Single Post
  #12  
Old 08-30-2016, 07:22 AM
  GlasPak's Avatar 
GlasPak GlasPak is offline
 

eXpert
  
Join Date: May 2015
Posts: 241
 

Default Re: how I add a new field to orders in admin area ?

Quote:
Originally Posted by qualiteam
You should change your Product class as follows:
PHP Code:
<?php
// vim: set ts=4 sw=4 sts=4 et:

namespace XLite\Module\EBLIEB\GlasPak\Model;

class 
Product extends \XLite\Model\Product implements \XLite\Base\IDecorator
{
    
/**
     * @Column (type="string", length=32)
     */
    
protected $PPCField;
    
    
/**
     * Updates "Pieces per case" field.
     * 
     * @param string $value New value
     * 
     * @return void
     */
    
public function setPPCField($value)
    {
        
$this->PPCField $value;
    }

    
/**
     * Returns the value of "Pieces per case" field.
     * 
     * @return string
     */
    
public function getPPCField()
    {
        return 
$this->PPCField;
    }
}

X-Cart 5.3 doesn't add get/set methods automatically, so now you should add these methods manually (if you need them in your modules).

Doesn't seem to be working with 5.3

in skins\admin\en\modules\EBLIEB\GlasPak\

I have

Code:
{## # @ListChild (list="invoice.item.name", weight="20") #} {% if this.item.product.getPPCField() %} <li class="ppc-field"> <span class="name">{{ t('Pieces Per Case') }}</span> <span class="ppc-field-value">{{ this.item.product.getPPCField() }}</span> </li> {% endif %}

but it doesn't seem to add to the admin for each product like it did in 5.2 ...

This was based off of
http://devs.x-cart.com/en/basics/adding_new_property_to_a_product/

Any chance this will be updated in the future for 5.3?
__________________
Business License
https://glaspak.com
GoDaddy VPS - Apache with WHM
2GB ECC DDR3 1600MHz
2x Intel E5-2630L v2 Hex Core 2.4/2.8ghz
15 MB proc cache
60 GB 10k RPM hdd
PHP 7.0.15
MariaDB 10.1.21 with InnoDB engine
Reply With Quote