Merge branch 'ticket-13473-IVAForEs' into develop

This commit is contained in:
Marion Muszynski 2017-06-14 10:58:42 +02:00
commit a4b3b52b27
10 changed files with 315 additions and 203 deletions

View File

@ -1589,6 +1589,9 @@ class AdminOrders extends AdminTab
}
if(count($returnable) > 0) {
$instructions = array(
1 => 'Remboursement + Mise en stock',
2 => 'Échange',
3 => 'Défectueux',
4 => 'Commande à ré-expédier',
5 => 'Commande à rembourser',
);

View File

@ -35,11 +35,7 @@ include dirname(__FILE__).'/../../config/config.inc.php';
// Db::getInstance()->ExecuteS('
// UPDATE ps_discount
// SET
// `value` = 0,
// `id_discount_type` = 3,
// `minimal` = 10,
// `include_tax`= 0,
// `id_currency` = 0
// `include_tax`= 1,
// WHERE id_discount IN ('.implode(',',$discount_toclean).')
// ');
@ -93,7 +89,7 @@ function generateDiscount($id_customer)
$discount->cumulable = 0;
$discount->cumulable_reduction = 1;
$discount->minimal = 10;
$discount->include_tax = 0;
$discount->include_tax = 1;
$discount->cart_display = 0;
$discount->active = 1;
$discount->quantity = 1;

View File

@ -909,12 +909,13 @@ class AdminAntReturnprocess extends AdminTab
<div class="row">
<div class="col-md-7">
<div>';
$return_link = Db::getInstance()->getRow('
SELECT `return_number`, `link`
$return_link = Db::getInstance()->getRow('
SELECT `return_number`, `link`, `return_comment`
FROM `'._DB_PREFIX_.'order_return_link`
WHERE `id_order_return` = '.(int) $id_order_return.'
');
$html .= '<p class="text-purple-dark" style="font-weight:bold;"><span class="anticon anticon-qrcode"></span> Lien retour Etiquette MR : '.($return_link? '<a style="color:#444;" href="'.$return_link['link'].'" onclick="window.open(this.href); return false;">'.$return_link['return_number'].'</a> <a class="text-purple-dark" title="Renvoyer les instructions retour" href="'.$currentIndex.'&send_return_instruction=1&updateorder_return&id_order_return='.$id_order_return.'&id_order='.(int)$order->id.'&token='.$this->token.'"><i class="glyphicon glyphicon-send"></i></a>':'Pas de lien retour').'<p>';
$html .= '<p class="text-purple-dark" style="font-weight:bold;">'.(($return_link && !empty($return_link['return_comment']))?'Commentaire : " '.$return_link['return_comment'].' "':'Sans commentaire').'<p>';
$html .= '</div>
<table class="table">
<thead>
@ -971,18 +972,31 @@ class AdminAntReturnprocess extends AdminTab
<div class="col-md-offset-1 col-md-4">';
if($return_history && !empty($return_history)) {
$html .= '
<p style="margin-bottom:0;">'.$this->l('Historique :').'</p>
<table class="table">';
foreach ($return_history as $key => $history) {
$html .= '
<tr>
<td style="font-size:11px;">'.date('d/m/Y H:i',strtotime($history['date_add'])).'</td>
<td style="font-size:11px;font-weight:bold">'.$history['state'].'</td>
<td style="font-size:11px;">'.$history['employee'].'</td>
</tr>';
}
$html .= '
</table>';
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">
'.$this->l('Statut').'
<a class="pull-right" style="color:#fff;" role="button" data-toggle="collapse" href="#collapseHistory" aria-expanded="false" aria-controls="collapseHistory">
<i class="anticon anticon-info"></i>
</a>
</h5>
<p class="text-center">
<b>'.$return_history[0]['state'].' <span style="font-size:24px;" class="'.$colorStates[$orderReturn->state].'"></span></b><br>('.$return_history[0]['employee'].' - '.date('d/m/Y H:i',strtotime($return_history[0]['date_add'])).')
</p>
<div class="collapse" id="collapseHistory">
<div class="well">
<table class="table">';
foreach ($return_history as $key => $history) {
$html .= '
<tr>
<td style="font-size:11px;">'.date('d/m/Y H:i',strtotime($history['date_add'])).'</td>
<td style="font-size:11px;font-weight:bold">'.$history['state'].'</td>
<td style="font-size:11px;">'.$history['employee'].'</td>
</tr>';
}
$html .= '
</table>
</div>
</div>';
}
$html .= '
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">'.$this->l('Changer le statut du retour').'</h5>
@ -1231,6 +1245,44 @@ class AdminAntReturnprocess extends AdminTab
<input type="submit" name="submitOrderState" value="'.$this->l('Change').'" class="btn btn-primary btn-block" />
</form>
</div>
<div class="col-md-6">
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">'.($order->module ? ($order->module=="paybox"?'<span class="anticon anticon-credit-card"></span> ':'<span class="anticon anticon-paypal"></span> ') : '').' Info Remboursement</h5>
<div style="padding:10px 20px;background:#efefef;font-size: 12px;" class="">';
if($order->module && $order->module=="paybox"){
require_once dirname(__FILE__).'/../../modules/paybox/paybox.php';
$refundsPaybox = Paybox::getAllRefundbyOrder($order->id);
if (sizeof($refundsPaybox))
{
$html .='<table class="table table-condensed" width="100%;" cellspacing="0" cellpadding="0">';
foreach ($refundsPaybox as $refund) {
$html .='
<tr>
<td><b>'.(!empty($refund['product_name'])?$refund['product_name']:'Frais de port').'</b></td>
<td>'. $refund['amount'] / 100 . '</td>
</tr>';
}
$html .='</table>';
} else {
$html .= '<p>Pas de remboursement</p>';
}
} elseif($order->module && $order->module=="paypal") {
$messages = Db::getInstance()->ExecuteS('
SELECT `message`, `date_add`
FROM `ps_message`
WHERE `id_order` = '.$order->id.'
AND (`message` LIKE "%Refund operation%" || `message` LIKE "%Cancel products%")
ORDER BY `date_add` DESC
');
if($messages && !empty($messages)) {
foreach ($messages as $message) {
$html .= '<p>('.date('d/m/Y',strtotime($message['message'])).'):<br>'.$message['message'].'</p>';
}
}
}
$html .='</div>
</div>
</div>
</div>
</div>

View File

@ -650,12 +650,11 @@ function confirmation(idProduct, idCombination, quantity, json) {
// AJOUT PANIER PAGE PRODUIT
if($('#quantity_sel').length > 0){
$('#quantity_sel').html(quantity);
if(quantity > 1){
var price = $('#price_add_to_cart').html();
var price_float = price.replace(",", ".");
var new_price = parseFloat(price_float) * quantity;
$('#price_add_to_cart').html(new_price);
}
var price = $('#our_price_display').html();
price = price.replace(' €','');
var price_float = price.replace(",", ".");
var new_price = parseFloat(price_float) * quantity;
$('#price_add_to_cart').html(String(new_price.toFixed(2)).replace('.',','));
$('.overlay_bbb').fadeIn();
$('.box_add_to_cart').fadeIn();
// send add product to cart information to GA

View File

@ -9,7 +9,7 @@ global $smarty;
$id_product = Tools::getValue('id_product', 0);
$idCombination = Tools::getValue('idCombination', 0);
if($id_product){
if($id_product){
$product = new Product($id_product, false, $cookie->id_lang);
$quantity = Tools::getValue('quantity', 1);
@ -39,7 +39,7 @@ if($id_product){
'img_dir' => '/themes/site/img/',
'quantity' => $quantity,
'bestSaleCart' => $bestSaleCart,
'price' => $price,
'price' => number_format($price, 2, ',', ''),
'delivery_delay' => (isset($delivery_delay) ? $delivery_delay : null)
));

View File

@ -671,6 +671,11 @@ class AdminPhileaMagistor extends AdminTab {
AND `filename` LIKE "CRP%"
AND `report_data` IS NOT NULL
');
$crr_report = Db::getInstance()->executeS('
SELECT `quantity_received`, `quantity_expected`, `status`, `date_upd`
FROM `'._DB_PREFIX_.'philea_stock_sync`
WHERE `id_sale` = '.(int) $CRR['id_sale'] .'
');
$form .= '<tr>
<td><input type="checkbox" id="check_sale_'.(int) $CRR['id_sale'].'" name="id_sales[]" value="'.(int) $CRR['id_sale'].'" /></td>
@ -704,12 +709,13 @@ class AdminPhileaMagistor extends AdminTab {
</td>
</tr>
<tr class="collapse info_more_th row_more_'.(int) $CRR['id_sale'].'">
<td align="center" colspan="3"><u>Rapport Base Produits</u></td>
<td align="center" colspan="2"><u>Rapport Base Produits</u></td>
<td align="center" colspan="1"><u>Rapport Attendus</u></td>
<td align="center" colspan="2"><u>Rapports Envois Commandes</u></td>
<td align="center" colspan="3"><u>Rapports Preparations</u></td>
</tr>
<tr class="collapse info_more_tr row_more_'.(int) $CRR['id_sale'].'">
<td align="center" colspan="3">';
<td align="center" colspan="2">';
if(!empty($art_reports)){
foreach($art_reports as $key => $report) {
$form .= '<div>
@ -719,6 +725,40 @@ class AdminPhileaMagistor extends AdminTab {
}
}
$form .= '</td>
<td align="center" colspan="1">';
if(!empty($crr_report)) {
foreach($crr_report as $key => $report) {
$received = (Array)json_decode($report['quantity_received']);
$expected = (Array)json_decode($report['quantity_expected']);
$btn='primary';
if((int)$report['status'] == 2){
$btn='danger';
} elseif((int)$report['status'] == 0) {
$btn='default';
} elseif((int)$report['status'] == 1) {
$btn='primary';
}
$form .= '<div>
<a class="btn btn-'.$btn.' btn-xs see_report" data-id="'. (int) $CRR['id_sale'] .'" data-key="'.(int)$key.'" data-type="CRR" href="#" title="'.$this->l('See CRR report').'"><span class="anticon anticon-file-text2"></span> '.date('d/m/Y H:i',strtotime($report['date_upd'])).'</a>
<div id="'.(int) $CRR['id_sale'].'_'.$key.'_CRR" style="display:none">';
foreach ($expected as $product => $quantity) {
$class='';
if($received[$product] == $quantity){
$class = 'text-success';
} elseif($received[$product] > $quantity){
$class = 'text-info';
} elseif($received[$product] == 0){
$class = 'text-danger';
} elseif($received[$product] < $quantity){
$class = 'text-warning';
}
$form.='<p>'.$product.' : <b><span class="'.$class.'">'.$received[$product].'</span> / '.$quantity.'</b></p>';
}
$form.='</div>
</div>';
}
}
$form .= '</td>
<td align="center" colspan="2">';
if(!empty($cdc_reports)){
$form .= '<div class="reports">';
@ -757,6 +797,7 @@ class AdminPhileaMagistor extends AdminTab {
</div>
</div>
<div class="div_report_overlay"></div>
<script type="text/javascript">
$("document").ready(function(){
$(".see_more").click(function(){

View File

@ -1,169 +1,179 @@
<?php
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
include('../../../config/settings.inc.php');
include('../../../config/config.inc.php');
@ini_set('display_errors', 'on');
include( dirname(__FILE__) . '/../philea_magistor.php');
global $regex_file_in;
$regex_file_in = '@^CRR(.*)\.(BAL|DAT)@';
$magistorModule = new philea_magistor();
## FILE FORMAT
/**
* CHAMPS VALEURS COMMENTAIRES DEBUT LONGUEUR
* OP_CODE « REC01 » « REC01 » : balise fichier de réception 1 10
* CODE_SOC ALPHA-NUMERIQUE Code société gestionnaire à définir 11 20
* N_PIECE ALPHA-NUMERIQUE Numéro de réception ou numéro de commande dachat 31 20
* DATE_RECEP NUMERIQUE (YYYYMMDD) Date de réception 51 8
* CODE_ART ALPHA-NUMERIQUE Code Article 59 50
* QTE NUMERIQUE Quantité réellement réceptionnée 109 10
* NO_LOT NUMERIQUE Numéro de lot 119 20
* DATE_DLV NUMERIQUE (YYYYMMDD) Date limite de vente ou date de fabrication 139 8
* COMMT ALPHA-NUMERIQUE Commentaires / Litige 147 100
* NUM_BL ALPHA-NUMERIQUE Numéro du BL fournisseur si connu 247 50
*/
$CRR = array(
'OP_CODE' => array(1,10),
'CODE_SOC' => array(11,20),
'N_PIECE' => array(31,20),
'DATE_RECEP' => array(51,8),
'CODE_ART' => array(59,50),
'QTE' => array(109,10),
'NO_LOT' => array(119, 20),
'DATE_DLV' => array(139, 8),
'COMMT' => array(147, 100),
'NUM_BL' => array(247, 50),
);
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_PORT'] = 80;
$format = $CRR;
if($magistorModule->active) {
require_once('connection_ftp.php');
@set_time_limit(0);
$inFolder = dirname(__FILE__) . '/IN/';
$iterator = new DirectoryIterator($inFolder);
if(is_object($iterator) && count($iterator)) {
include(dirname(__FILE__) . '/../../../config/config.inc.php');
include( dirname(__FILE__) . '/../philea_magistor.php');
foreach ($iterator as $fileinfo) {
if (!$fileinfo->isFile() || $fileinfo->getFilename() == '..' || $fileinfo->getFilename() == '.')
continue;
if( !preg_match( '@^CRR(.*)\.BAL@', $fileinfo->getFilename() ) )
continue;
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
if( !file_exists( $datFile ) )
continue;
@ini_set('display_errors', 'on');
$content = file_get_contents( $datFile );
$lines = preg_split( '@\n@', $content );
global $regex_file_in;
$regex_file_in = '@^CRR(.*)\.(BAL|DAT)@';
if( empty($lines) )
continue;
// get DATA
$sales = array();
foreach( $lines as $line ) {
$data = array();
foreach($format as $field => $value) {
$data[] = substr($line, ($value[0]-1), $value[1]);
if (isset($data[2]) && $data[2])
$sales[] = (int) str_replace('OP', '', $data[2]);
}
$magistorModule = new philea_magistor();
## FILE FORMAT
/**
* CHAMPS VALEURS COMMENTAIRES DEBUT LONGUEUR
* OP_CODE « REC01 » « REC01 » : balise fichier de réception 1 10
* CODE_SOC ALPHA-NUMERIQUE Code société gestionnaire à définir 11 20
* N_PIECE ALPHA-NUMERIQUE Numéro de réception ou numéro de commande dachat 31 20
* DATE_RECEP NUMERIQUE (YYYYMMDD) Date de réception 51 8
* CODE_ART ALPHA-NUMERIQUE Code Article 59 50
* QTE NUMERIQUE Quantité réellement réceptionnée 109 10
* NO_LOT NUMERIQUE Numéro de lot 119 20
* DATE_DLV NUMERIQUE (YYYYMMDD) Date limite de vente ou date de fabrication 139 8
* COMMT ALPHA-NUMERIQUE Commentaires / Litige 147 100
* NUM_BL ALPHA-NUMERIQUE Numéro du BL fournisseur si connu 247 50
*/
$CRR = array(
'OP_CODE' => array(1,10),
'CODE_SOC' => array(11,20),
'N_PIECE' => array(31,20),
'DATE_RECEP' => array(51,8),
'CODE_ART' => array(59,50),
'QTE' => array(109,10),
'NO_LOT' => array(119, 20),
'DATE_DLV' => array(139, 8),
'COMMT' => array(147, 100),
'NUM_BL' => array(247, 50),
);
$format = $CRR;
if($magistorModule->active) {
require_once('connection_ftp.php');
@set_time_limit(0);
$inFolder = dirname(__FILE__) . '/IN/';
$iterator = new DirectoryIterator($inFolder);
if(is_object($iterator) && count($iterator)) {
foreach ($iterator as $fileinfo) {
if (!$fileinfo->isFile() || $fileinfo->getFilename() == '..' || $fileinfo->getFilename() == '.'){
continue;
}
if( !preg_match( '@^CRR(.*)\.BAL@', $fileinfo->getFilename() ) ){
continue;
}
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
if( !file_exists( $datFile ) ){
continue;
}
$content = file_get_contents( $datFile );
$lines = preg_split( '@\n@', $content );
if( empty($lines) ){
continue;
}
// GET DATA
$sales = array();
foreach( $lines as $line ) {
$data = array();
foreach($format as $field => $value) {
$data[] = substr($line, ($value[0]-1), $value[1]);
}
// GET SALE ID
if (!isset($data[2]) || (isset($data[2]) && !$data[2])){
continue;
}
$id_sale = (int) str_replace('OP', '', (string) trim($data[2]));
if (!isset($sales[$id_sale])) {
$query_stock = Db::getInstance()->getRow('
SELECT `quantity_expected`, `quantity_received`, `status`
FROM `'._DB_PREFIX_.'philea_stock_sync`
WHERE `id_sale`='.(int)$id_sale.'
');
if(!$query_stock){
continue;
}
$sales[$id_sale] = array(
'expected' => (Array)json_decode($query_stock['quantity_expected']),
'received' => (Array)json_decode($query_stock['quantity_received']),
'status' => ($query_stock['status'] == 0 ? 1:$query_stock['status'])
);
}
if (!isset($data[4]) || !$data[4] || !isset($data[5])){
continue;
}
$product = trim($data[4]);
$product = explode('_', $product);
$id_product = (int) $product[0];
$id_product_attribute = (isset($product[1]) ? (int) $product[1] : 0);
if($id_product_attribute!=0){
$ref = $id_product.'_'.$id_product_attribute;
} else {
$ref = $id_product;
}
// GET PRODUCT/QTY
if((int)$data[5] == 0){
$sales[$id_sale]['status'] = 2;
}
$sales[$id_sale]['received'][$ref] += (int)$data[5];
unset($data);
}
## UPDATE SUPPLIER_ORDER
// GET SALE ID
if( !isset($data[2]) || (isset($data[2]) && !$data[2]) )
continue;
$id_sale = (int) str_replace('OP', '', (string) trim($data[2]));
## LOG RECEPTION FILE
// $fp = fopen("reception.txt", "w");
// fputs ($fp, $content);
// fclose ($fp);
// GET PRODUCT
$product = trim($data[4]);
$product = explode('_', $product);
$id_product = (int) $product[0];
$id_product_attribute = (isset($product[1]) ? (int) $product[1] : 0);
// $email = Configuration::get('PS_SHOP_EMAIL');
$email = 'marion@antadis.com';
// Mail::Send(
// Configuration::get('PS_LANG_DEFAULT'),
// 'philea_reception',
// 'Fichier de rŽception',
// array('{date}' => date('d/m/Y H:i:s')),
// $email,
// NULL,
// NULL,
// NULL,
// array(
// 'name' => 'reception.txt',
// 'mime' => 'text/plain',
// 'content' => file_get_contents('reception.txt')
// )
// );
// GET QTY
if (!isset($data[5]) || !$data[5])
continue;
$qty = (int) $data[5];
if (!$qty)
continue;
// SAVE INTO ARCHIVE
$repo_archive = dirname(__FILE__) . '/archives/IN/RECEPTION/';
$repo_paths = array(date('Y'), date('m'));
foreach ($repo_paths as $repo_path) {
$repo_archive .= $repo_path . '/';
if (!file_exists($repo_archive))
mkdir($repo_archive);
}
// GET ORDER FORM ID
// get id in file
$id_order_form = false;
// if (isset($data[9]) && $data[9])
// $id_order_form = (int) trim($data[9]);
// else get id from sale id
if (!$id_order_form){
$id_order_form = Db::getInstance()->getValue('
SELECT `id_order_form`
FROM `' . _DB_PREFIX_ . 'supplier_order`
WHERE `id_sale` = ' . (int) $id_sale);
}
if (!$id_order_form)
continue;
$datfile_name = preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
$update_sql = '
UPDATE `' . _DB_PREFIX_ . 'supplier_order_detail`
SET `quantity_accepted` = `quantity_accepted` + ' . (int)$qty . '
WHERE `id_order_form` = ' . (int) $id_order_form . '
AND `id_product` = ' . (int) $id_product . '
AND `id_product_attribute` = ' . (int) $id_product_attribute . '
LIMIT 1';
Db::getInstance()->execute($update_sql);
unset($data);
}
$sales = array_unique($sales);
$sales = array_unique($sales);
foreach ($sales as $id_sale => $detail) {
$query = Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'philea_stock_sync`
SET
`date_upd` = NOW(),
`status` = '.(int)$detail['status'].',
`quantity_received` = "'.pSQL(json_encode($detail['received'])).'"
WHERE `id_sale` = '.(int)$id_sale.'
LIMIT 1
');
echo '<pre>';var_dump($query);echo '</pre>';die();
}
## LOG RECEPTION FILE
$fp = fopen("reception.txt", "w");
fputs ($fp, $content);
fclose ($fp);
// $email = Configuration::get('PS_SHOP_EMAIL');
$email = 'coppee@antadis.com';
Mail::Send(
Configuration::get('PS_LANG_DEFAULT'),
'philea_reception',
'Fichier de rŽception',
array('{date}' => date('d/m/Y H:i:s')),
$email,
NULL,
NULL,
NULL,
array(
'name' => 'reception.txt',
'mime' => 'text/plain',
'content' => file_get_contents('reception.txt')
)
);
// SAVE INTO ARCHIVE
$repo_archive = dirname(__FILE__) . '/archives/IN/RECEPTION/';
$repo_paths = array(date('Y'), date('m'));
foreach ($repo_paths as $repo_path) {
$repo_archive .= $repo_path . '/';
if (!file_exists($repo_archive))
mkdir($repo_archive);
}
$datfile_name = preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
$sql_insert = array();
foreach ($sales as $id_sale)
$sql_insert[] = '(' . (int) $id_sale . ', "' . pSQL($datfile_name) . '", NOW())';
$sql = 'INSERT INTO `'._DB_PREFIX_.'philea_magistor_reception` VALUES ' . implode(',', $sql_insert);
Db::getInstance()->execute($sql);
// CLEAN FILE
copy($datFile, $repo_archive . $datfile_name);
unlink($inFolder.$fileinfo->getFilename());
unlink($datFile);
}
}
}
// CLEAN FILE
copy($datFile, $repo_archive . $datfile_name);
unlink($inFolder.$fileinfo->getFilename());
unlink($datFile);
}
}
}

View File

@ -118,6 +118,8 @@ if($magistorModule->active) {
}
$data = '';
$product_quantities = array();
$product_quantities2 = array();
foreach( $products as $product ) {
/**
* @Override check pack items
@ -148,9 +150,12 @@ if($magistorModule->active) {
$data .= str_pad( $attribute['quantity'], 10, '0', STR_PAD_LEFT );
$data .= str_pad( '', 10, '0', STR_PAD_LEFT );
$data .= str_pad( '', 250, ' ', STR_PAD_LEFT );
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
$data .= str_pad( '0001', 50, ' ', STR_PAD_RIGHT );
$data .= str_pad( str_replace(array("\r", "\n"), "", $attribute['ean13']), 14, ' ', STR_PAD_LEFT );
$data .= PHP_EOL;
$product_quantities[$product['id_product'].'_'.$attribute['id_product_attribute']] = (int)$attribute['quantity'];
$product_quantities2[$product['id_product'].'_'.$attribute['id_product_attribute']] = 0;
}
} else {
if(isset($product['ean13']) && !empty($product['ean13'])) {
@ -167,24 +172,29 @@ if($magistorModule->active) {
$data .= str_pad( $product['quantity'], 10, '0', STR_PAD_LEFT );
$data .= str_pad( '', 10, '0', STR_PAD_LEFT );
$data .= str_pad( '', 250, ' ', STR_PAD_LEFT );
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
$data .= str_pad( '0001', 50, ' ', STR_PAD_RIGHT );
$data .= str_pad( str_replace(array("\r", "\n"), "", $product['ean13']), 14, ' ', STR_PAD_LEFT );
$data .= PHP_EOL;
$product_quantities[$product['id_product']] = (int)$product['quantity'];
$product_quantities2[$product['id_product']] = 0;
}
}
if($data != '') {
$file = 'REC01'.$dateNow.'.DAT';
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'philea_syncreport` (`id_sale`, `filename`, `date_add`)
VALUES (
'.(int)$id_sale.',
"'.pSQL($file).'",
NOW()
)
');
Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'philea_stock_sync`
VALUES (DEFAULT,' . (int) $id_sale . ',0, NOW())
VALUES
(
DEFAULT,
' . (int) $id_sale . ',
0,
"'.pSQL(json_encode($product_quantities)).'",
"'.pSQL(json_encode($product_quantities2)).'",
NOW(),
NOW()
)
');
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
@ -198,5 +208,5 @@ if($magistorModule->active) {
require_once('connection_ftp.php');
}
echo 'fin';
echo 'fin'."\n";
}

View File

@ -337,7 +337,8 @@ function updateDisplay()
//productPrice = ps_round(productPrice * currencyRate, 2);
if (productPrice > 0){
$('#our_price_display').text(formatCurrency(productPrice, currencyFormat, currencySign, currencyBlank));
$('#price_add_to_cart').text(formatCurrency(productPrice, currencyFormat, currencySign, currencyBlank));
//$('#price_add_to_cart').text(formatCurrency(productPrice, currencyFormat, currencySign, currencyBlank));
$('#price_add_to_cart').text(String(productPrice.toFixed(2)).replace(".", ","));
}
else
$('#our_price_display').text(formatCurrency(0, currencyFormat, currencySign, currencyBlank));

View File

@ -2,7 +2,7 @@
<li class="ajax_block_product {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if} clearfix {if $product.quantity_all_versions <= 0 && $product.quantity <= 0}out{/if}">
<div class="left_block">
<a class="" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">
{if $product.quantity_all_versions <= 0 && $product.quantity <= 0}<img class="rubber" src="{$img_dir}rubber.png?v=2" alt="{l s='Out of stock'}" />{/if}
{if $product.quantity_all_versions <= 0 && $product.quantity <= 0}<img class="rubber" src="{$img_dir}rubber.png?v=2" alt="{l s='Out of stock' mod='categoryscroll'}" />{/if}
<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
</a>
</div>
@ -31,17 +31,17 @@
{if isset($product.quantity_all_versions) && $product.quantity_all_versions <= $last_qties && $product.quantity_all_versions > 0}
<div class="productQuantityAlert">
{if $product.quantity_all_versions == 1}
<p>{l s='Warning: 1 item in stock!'}</p>
<p>{l s='Warning: 1 item in stock!' mod='categoryscroll'}</p>
{else}
<p>{l s='Warning :'} {$product.quantity_all_versions} {l s='items in stock'}</p>
<p>{l s='Warning :' mod='categoryscroll'} {$product.quantity_all_versions} {l s='items in stock' mod='categoryscroll'}</p>
{/if}
</div>
{elseif !isset($product.quantity_all_versions) && $product.quantity <= $last_qties && $product.quantity > 0}
<div class="productQuantityAlert">
{if $product.quantity == 1}
<p>{l s='Warning: 1 item in stock!'}</p>
<p>{l s='Warning: 1 item in stock!' mod='categoryscroll'}</p>
{else}
<p>{l s='Warning :'} {$product.quantity} {l s='items in stock'}</p>
<p>{l s='Warning :' mod='categoryscroll'} {$product.quantity} {l s='items in stock' mod='categoryscroll'}</p>
{/if}
</div>
{/if}