gemaadn Posted May 12, 2014 Share Posted May 12, 2014 Hola,me gustaría añadir un nuevo campo en la ventana de compra. Cuando muestra la lista de transportistas me gustaría añadir la opción de portes pagados o debidos. Ya he modificado el order-carrier.tpl con el siguiente código <select name="portes" id="portes" class="address_select form-control"> <option value="P" selected="selected">{l s='Pagados'}</option> <option value="D">{l s='Debidos'}</option> </select> Y en el Order php he agregado la definición de la variable (ya sé que no debo de modificar la clase, y debo de hacer los cambios en el override pero es para asegurarme que funciona). public $portes; y la he agregado en public static $definition = array( 'table' => 'orders', 'primary' => 'id_order', 'fields' => array( 'id_address_delivery' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_address_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'current_state' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'secure_key' => array('type' => self::TYPE_STRING, 'validate' => 'isMd5'), 'payment' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true), 'module' => array('type' => self::TYPE_STRING, 'validate' => 'isModuleName', 'required' => true), 'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'gift_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'), 'mobile_theme' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'total_discounts' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_discounts_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_discounts_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_paid' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), 'total_paid_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_paid_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_paid_real' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), 'total_products' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), 'total_products_wt' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), 'total_shipping' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_shipping_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_shipping_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'carrier_tax_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'), 'total_wrapping' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_wrapping_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'total_wrapping_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'shipping_number' => array('type' => self::TYPE_STRING, 'validate' => 'isTrackingNumber'), 'conversion_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true), 'invoice_number' => array('type' => self::TYPE_INT), 'delivery_number' => array('type' => self::TYPE_INT), 'invoice_date' => array('type' => self::TYPE_DATE), 'delivery_date' => array('type' => self::TYPE_DATE), 'valid' => array('type' => self::TYPE_BOOL), 'reference' => array('type' => self::TYPE_STRING), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'portes' => array('type' => self::TYPE_STRING), ), ); También he creado el campo en la base de datos, pero no me guarda el valor. ¿Alguién sabe por qué puede ser? Estoy utilizando prestashop 1.6 y la plantilla default-bootstrap Link to comment Share on other sites More sharing options...
Josraso Posted May 12, 2014 Share Posted May 12, 2014 Entiendo que te falta agregar portes en la tabla orders. Link to comment Share on other sites More sharing options...
gemaadn Posted May 13, 2014 Author Share Posted May 13, 2014 Si tengo creado ese campo en la tabla ps_orders. Link to comment Share on other sites More sharing options...
ventura Posted May 13, 2014 Share Posted May 13, 2014 puede ser por el validate del array 'portes' => array('type' => self::TYPE_STRING, 'validate' => 'isportes'), Link to comment Share on other sites More sharing options...
gemaadn Posted May 13, 2014 Author Share Posted May 13, 2014 Muchas gracias por responder, pero lo he probado y sigue sin guardarlo en la base de datos. Link to comment Share on other sites More sharing options...
Lili8 Posted April 20, 2015 Share Posted April 20, 2015 Te falta crear el campo en la tabla ps_orders en el base de datos. Espero que te pueda ayudar. Link to comment Share on other sites More sharing options...
Recommended Posts