View Single Post
  #1  
Old 09-08-2016, 08:21 AM
  GlasPak's Avatar 
GlasPak GlasPak is offline
 

eXpert
  
Join Date: May 2015
Posts: 241
 

Default Help with "creating interface" in admin on 5.3

So most of my module is working now (except my new database column data got erased when I upgraded my dev site from 5.2 to 5.3)

The only part that isn't working is


Code:
Creating interface for editing this field Now we need to be able to specify value of this property on product details page in admin area. We decorate \XLite\View\Model\Product class and create <X-Cart>/classes/XLite/Module/Tony/ProductFieldDemo/View/Model/Product.php file with the following content: <?php // vim: set ts=4 sw=4 sts=4 et: namespace XLite\Module\Tony\ProductFieldDemo\View\Model; class Product extends \XLite\View\Model\Product implements \XLite\Base\IDecorator { public function __construct(array $params = array(), array $sections = array()) { parent::__construct($params, $sections); $this->schemaDefault += array ( 'testField' => array( self::SCHEMA_CLASS => 'XLite\View\FormField\Input\Text', self::SCHEMA_LABEL => 'Test field', self::SCHEMA_REQUIRED => false, ), ); } } Such code will add a new field to the product details page in admin area. This field will be named Test field and its value will be saved into testField field of xc_products MySQL table. The FormField class that defines an input field in the interface is default \XLite\View\FormField\Input\Text one. Note: see an example of creating model editing form with more detailed explanation here: Model editing page.


I tried using the kb for upgrading modules to 5.3 from 5.2 but it doesn't seem to work. Any help on the changes needed here?
__________________
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