rferrero Posted May 20, 2013 Share Posted May 20, 2013 (edited) Hola He añadido un nuevo campo en la tabla ps_product llamado discountBW es un bool (checkbock) He modificado el archivo **admin/themes/default/template/controllers/products/informations.tpl en la linea 254 debajo de online_only <li> <input type="checkbox" name="online_only" id="online_only" value="1" {if $product->online_only}checked="checked"{/if} /> <label for="online_only" class="t">{l s='Online only (not sold in store)'}</label> </li> <li> <input type="checkbox" name="discountBW" id="discountBW" value="1" {if $product->discountBW}checked="checked"{/if} /> <label for="discountBW" class="t">{l s='Descuento por transferencia'}</label> </li> y añadido en product.php public $discountBW = true; public static $definition = array( 'table' => 'product', 'primary' => 'id_product', 'multilang' => true, 'multilang_shop' => true, 'fields' => array( // Classic fields 'id_shop_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32), 'supplier_reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32), 'location' => array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 64), 'delivery' => array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 64), 'width' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'), 'height' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'), 'depth' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'), 'weight' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'), 'quantity_discount' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13), 'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12), 'cache_is_pack' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'cache_has_attachments' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'is_virtual' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'discountBW' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), etc etc El problema es que una vez el valor lo establezco a 1 ya no se actualiza a 0 Que es lo que tengo mal? Un saludo Edited May 21, 2013 by rferrero (see edit history) Link to comment Share on other sites More sharing options...
rferrero Posted May 20, 2013 Author Share Posted May 20, 2013 (edited) Que diferencia hay entre 'discountBW' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'), y 'discountBW' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), ????? Edited May 20, 2013 by rferrero (see edit history) Link to comment Share on other sites More sharing options...
rferrero Posted May 21, 2013 Author Share Posted May 21, 2013 Alguien sabe como añadir un checkbox en la pestaña de información de un producto? Un saludo Link to comment Share on other sites More sharing options...
rferrero Posted May 21, 2013 Author Share Posted May 21, 2013 (edited) Que diferencia hay entre 'discountBW' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'), y 'discountBW' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), ????? 'shop' => true significa que es de la tabla product_shop, por lo tanto tengo que usar array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), Pero sigue sin funcionar Edited May 21, 2013 by rferrero (see edit history) Link to comment Share on other sites More sharing options...
rferrero Posted May 21, 2013 Author Share Posted May 21, 2013 Solucionado Override clase AdminProductsController.php Linea 326 $object->discountBW = (int)Tools::getValue('discountBW'); Linea 3430 // global informations array_push($product_props, 'reference', 'ean13', 'upc', 'available_for_order', 'show_price', 'online_only', 'id_manufacturer','discountBW' ); 1 Link to comment Share on other sites More sharing options...
Recommended Posts