Respuesta: No hay modo de añadir <br> \ n $foo El fichero AdminOrdersController.php de prestashop es muy largo (2500 lineas) e incluye código que se muestra en páginas diferentes a la lista de pedidos que estoy modificando, adjuntaré las primeras lineas que intervienen en la página de order list remarcando en rojo mis modificaciones y en azul los <br> que no funcionan, parece ser que este fichero tambien me ignora el DATE_FORMAT en español: Cita: <?php
use PrestaShop\PrestaShop\Adapter\StockManager; setlocale(LC_TIME, "es_ES");
class AdminOrdersControllerCore extends AdminController
{
public $toolbar_title;
protected $statuses_array = array();
public function __construct()
{
$this->bootstrap = true;
$this->table = 'order';
$this->className = 'Order';
$this->lang = false;
$this->addRowAction('view');
$this->explicitSelect = true;
$this->allow_export = true;
$this->deleted = false;
parent::__construct(); $lista = explode("|", $resultado);
echo join("<br>", $lista);
$this->_select = ' a.reference,
a.id_currency,
a.id_order AS id_pdf,
CONCAT(c.`firstname`, \' \', c.`lastname`, \'<br/> \', c.`email`) AS `customer`,
osl.`name` AS `osname`,
os.`color`, (SELECT (DATE_FORMAT(DATE_ADD(op.`date_add`,INTERVAL 7 + IF((WEEKDAY(DATE_ADD(op.`date_add`, INTERVAL 7 DAY)) IN (5)), 2, 0) + IF((WEEKDAY(DATE_ADD(op.`date_add`, INTERVAL 7 DAY)) IN (6)), 1, 0) DAY), "%W, %e de %M")) FROM `'._DB_PREFIX_.'order_payment` op WHERE op.`order_reference` = a.`reference`) as dat, (SELECT GROUP_CONCAT(so.product_quantity, \' x \', so.product_name SEPARATOR " | ") FROM `'._DB_PREFIX_.'order_detail` so WHERE so.id_order = a.id_order) as productos,
IF((SELECT so.id_order FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new,
country_lang.name as cname,
IF(a.valid, 1, 0) badge_success';
$this->_join = ' LEFT JOIN `'._DB_PREFIX_.'order_carrier` oc ON (a.`id_order` = oc.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) LEFT JOIN `'._DB_PREFIX_.'order_payment` op ON (op.`order_reference` = a.`reference`)
INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery
INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country
INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';
$this->_orderBy = 'id_order';
$this->_orderWay = 'DESC';
$this->_use_found_rows = true; $this->_group = 'GROUP BY a.id_order';
$statuses = OrderState::getOrderStates((int)$this->context->language->id);
foreach ($statuses as $status) {
$this->statuses_array[$status['id_order_state']] = $status['name'];
}
$this->fields_list = array(
'id_order' => array(
'title' => $this->trans('ID', array(), 'Admin.Global'),
'align' => 'text-center'
),
'reference' => array(
'title' => $this->trans('PEDIDO', array(), 'Admin.Global'),
'align' => 'text-center'
),
'customer' => array(
'title' => $this->trans('Customer', array(), 'Admin.Global'),
'havingFilter' => tr
'email' => array(
'title' => $this->l('Correo Electrónico'),
'filter_key' => 'a!email',
'class' => 'fixed-width-sm'
),ue,
'class' => 'fixed-width-xxl'
), 'tracking_number' => array(
'title' => $this->l('Tracking'),
'callback' => 'buildTrackingLink',
'align' => 'center'
),
'dat' => array(
'title' => $this->l('Día Entrega'),
'align' => 'center',
'orderby' => false,
'search' => false,
'class' => 'fixed-width-xs',
'callback' => 'getIsDat'
),
'productos' => array(
'title' => $this->l('Producto'),
'class' => 'fixed-width-xxl'
),
);
if (Configuration::get('PS_B2B_ENABLE')) {
$this->fields_list = array_merge($this->fields_list, array(
'company' => array(
'title' => $this->trans('Company', array(), 'Admin.Global'),
'filter_key' => 'c!company'
),
));
}
$this->fields_list = array_merge($this->fields_list, array(
'total_paid_tax_incl' => array(
'title' => $this->trans('Total', array(), 'Admin.Global'),
'align' => 'text-center',
'type' => 'price',
'currency' => true,
'callback' => 'setOrderCurrency',
'badge_success' => true
),
'osname' => array(
'title' => $this->trans('Status', array(), 'Admin.Global'),
'type' => 'select',
'color' => 'color',
'list' => $this->statuses_array,
'filter_key' => 'os!id_order_state',
'filter_type' => 'int',
'order_key' => 'osname'
),
'date_add' => array(
'title' => $this->trans('Date', array(), 'Admin.Global'),
'align' => 'text-right',
'type' => 'datetime',
'filter_key' => 'a!date_add'
),
'id_pdf' => array(
'title' => $this->trans('PDF', array(), 'Admin.Global'),
'align' => 'text-center',
'callback' => 'printPDFIcons',
'orderby' => false,
'search' => false,
'remove_onclick' => true
)
));
$this->shopLinkType = 'shop';
$this->shopShareDatas = Shop::SHARE_ORDER;
if (Tools::isSubmit('id_order')) {
// Save context (in order to apply cart rule)
$order = new Order((int)Tools::getValue('id_order'));
$this->context->cart = new Cart($order->id_cart);
$this->context->customer = new Customer($order->id_customer);
}
$this->bulk_actions = array(
'updateOrderStatus' => array('text' => $this->trans('Change Order Status', array(), 'Admin.Orderscustomers.Feature'), 'icon' => 'icon-refresh')
);
} public function getIsDat($a, $order)
{
return '<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="'.$order['dat'].'" data-html="true" data-placement="top"><i class="icon-truck"></i></span>';
}
public function buildTrackingLink($group, $row)
{
$order = new Order($row['id_order']);
$carrier = Carrier::getCarrierByReference($order->id_carrier);
return '<a class="tracking_number" target="_blank" href="http://www.seur.com/seguimiento-online.do?segOnlineIdentificador='.$row['tracking_number'].'"><script>$(\'document\').ready(function(){$(\'. tracking_number\').parent().removeAttr(\'onclick\' );});</script>'.$row['tracking_number'].'</a>';
}
public static function setOrderCurrency($echo, $tr)
{
$order = new Order($tr['id_order']);
return Tools::displayPrice($echo, (int)$order->id_currency);
}
public function initPageHeaderToolbar()
{
parent::initPageHeaderToolbar();
if (empty($this->display)) {
$this->page_header_toolbar_btn['new_order'] = array(
'href' => self::$currentIndex.'&addorder&token='.$this->token,
'desc' => $this->trans('Add new order', array(), 'Admin.Orderscustomers.Feature'),
'icon' => 'process-icon-new'
);
}
if ($this->display == 'add') {
unset($this->page_header_toolbar_btn['save']);
}
if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && isset($this->page_header_toolbar_btn['new_order'])
&& Shop::isFeatureActive()) {
unset($this->page_header_toolbar_btn['new_order']);
}
} En ese mismo fichero adjunto un código en el que se usa un str_replace Código PHP: $amount = str_replace(',', '.', Tools::getValue('payment_amount'));
Última edición por lepe; 28/10/2018 a las 12:07 |