Merge branch 'ticket-12204-ImportEan' into develop

This commit is contained in:
Marion Muszynski 2017-01-17 13:25:53 +01:00
commit 1bd6618395
5 changed files with 152 additions and 30 deletions

View File

@ -48,7 +48,67 @@ class AdminBulkUpdate extends AdminTab {
fclose($f);
$output .= '<p class="conf">'.$this->l('Product customs updated').'</p>';
}
}elseif (Tools::isSubmit('submitUploadQuantities')) {
}elseif (Tools::isSubmit('submitUploadEans')) {
if(isset($_FILES['csvfile']) && $_FILES['csvfile']['name'] != '') {
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
fgetcsv($f, 0, ';');
$i = 1;
while($line = fgetcsv($f, 0, ';')) {
$i++;
$product = new Product((int) $line[0]);
if(Validate::isLoadedObject($product)) {
if(isset($line[2]) && $line[2] != '' && !Validate::isEan13($line[2])) {
$output .= '<p class="error">'.$this->l('Invalid ean for this product ID on line').' '.$i.'</p>';
continue;
}
if((int) $line[1] != 0) {
if(!Db::getInstance()->getRow('
SELECT `id_product_attribute`
FROM `'._DB_PREFIX_.'product_attribute`
WHERE `id_product` = '.(int) $line[0].'
AND `id_product_attribute` = '.(int) $line[1].'
')) {
$output .= '<p class="error">'.$this->l('Invalid attribute ID for this product ID on line').' '.$i.'</p>';
continue;
}
}
if((int) $line[1] != 0) {
Db::getInstance()->ExecuteS('
UPDATE `'._DB_PREFIX_.'product_attribute`
SET `ean13` = "'.pSQL($line[2]).'"
WHERE `id_product` = '.(int) $line[0].'
AND `id_product_attribute` = '.(int) $line[1].'
LIMIT 1
');
} else {
Db::getInstance()->ExecuteS('
UPDATE `'._DB_PREFIX_.'product`
SET `ean13` = "'.pSQL($line[2]).'"
WHERE `id_product` = '.(int) $line[0].'
LIMIT 1
');
}
Db::getInstance()->ExecuteS('
UPDATE `'._DB_PREFIX_.'order_detail`
SET `product_ean13` = "'.pSQL($line[2]).'"
WHERE `product_id` = '.(int) $line[0].'
AND `product_attribute_id` = '.(int) $line[1].'
');
} else {
$output .= '<p class="warn">'.$this->l('Product #').(int) $line[0].' '.$this->l('not found').'</p>';
}
}
fclose($f);
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
} else {
$output .= '<p class="conf">'.$this->l('Pas de fichier csv !').'</p>';
}
} elseif (Tools::isSubmit('submitUploadQuantities')) {
$process = (int) Tools::getValue('qty_process');
if(isset($_FILES['csvfile']) && $_FILES['csvfile']['name'] != '') {
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
@ -1924,6 +1984,20 @@ class AdminBulkUpdate extends AdminTab {
</fieldset>
</form>';
$output .= '
<p><br /></p>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="/modules/bulkupdate/logo.gif" alt="" title="" />'.$this->l('Update EAN').'</legend>
<label>'.$this->l('File:').'</label>
<div class="margin-form">
<input type="file" name="csvfile" />
<p>'.$this->l('Format: id_product;id_product_attribute;ean -- the subsequent columns and the first line are ignored').'</p>
</div>
<p> </p>
<center><input type="submit" name="submitUploadEans" value="'.$this->l('Upload').'" class="button" /></center>
</fieldset>
</form>';
$langs = Language::getLanguages(false);
$output .= '
<p><br /></p>

View File

@ -114,12 +114,13 @@ class Catalog
$this->_xml .= '<channel>';
//Shop details
$this->_xml .= '<title>Bebeboutik.es</title>';
$this->_xml .= '<link>www.bebeboutik.es</link>';
$this->_xml .= '<link></link>';
$this->_xml .= '<description>Bebeboutik.es</description>';
$this->_xml .= '<logo>http://www.bebeboutik.es/img/logo_3.png</logo>';
$title_sunday = Configuration::get('TITLE_NEWS_DIMANCHE_ES');
$link_sale = 'http://www.bebeboutik.es';
$all_sales = 'Todas las ventas';
} else {
$flux = fopen("flux.xml", "w");
// Catalog
@ -132,6 +133,7 @@ class Catalog
$title_sunday = Configuration::get('TITLE_NEWS_DIMANCHE');
$link_sale = 'http://www.bebeboutik.com';
$all_sales = 'Toutes les ventes';
}
$sql_title = '
@ -156,14 +158,32 @@ class Catalog
$link = new Link();
$category = new Category($item->id_category);
$sale_link = $link->getCategoryLink($category->id, $category->link_rewrite[(int) $id_lang]);
if ($version == 'es') {
$sale_link = str_replace('bebeboutik.com', 'bebeboutik.es', $sale_link);
}
$sql = '
SELECT `value`
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
WHERE `id_field` = 1
AND `id_lang` = '.(int) $id_lang.'
AND `id_sale` = '.(int) $item->id
;
if ($value = Db::getInstance()->getValue($sql)) {
$item->small_title = $value;
} else {
$item->small_title = 'Non défini';
}
$this->_xml.='<sect_01>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<description><![CDATA['.$item->description[(int) $id_lang].']]></description>';
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
//$this->_xml .= '<description></description>';
//$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$sale_link.'</link>';
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
$this->_xml .= '<image>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]> <![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
$this->_xml .= '</image>';
@ -171,8 +191,9 @@ class Catalog
}
if (count($sales_today)%2 == 1){
$this->_xml.='<sect_01>';
$this->_xml .= '<title>></title>';
$this->_xml .= '<description>Bebeboutik.com</description>';
$this->_xml .= '<title></title>';
$this->_xml .= '<description><![CDATA['.$all_sales.']]></description>';
$this->_xml .= '<description></description>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$link_sale.'</link>';
$this->_xml .= '<reduction></reduction>';
@ -187,6 +208,9 @@ class Catalog
$link = new Link();
$category = new Category($item->id_category);
$sale_link = $link->getCategoryLink($category->id, $category->link_rewrite[(int) $id_lang]);
if ($version == 'es') {
$sale_link = str_replace('bebeboutik.com', 'bebeboutik.es', $sale_link);
}
$sql = '
SELECT `value`
@ -205,11 +229,13 @@ class Catalog
$this->_xml.='<sect_02>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<link>'.$link_sale.'</link>';
//$this->_xml .= '<description></description>';
//$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$sale_link.'</link>';
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
$this->_xml .= '<image>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]> <![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
$this->_xml .= '</image>';
@ -217,8 +243,9 @@ class Catalog
}
if (count($sales_last_day)%2 == 1){
$this->_xml.='<sect_02>';
$this->_xml .= '<title>></title>';
$this->_xml .= '<description>Bebeboutik.com</description>';
$this->_xml .= '<title></title>';
$this->_xml .= '<description><![CDATA['.$all_sales.']]></description>';
$this->_xml .= '<description></description>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$link_sale.'</link>';
$this->_xml .= '<reduction></reduction>';
@ -234,6 +261,9 @@ class Catalog
$link = new Link();
$category = new Category($item->id_category);
$sale_link = $link->getCategoryLink($category->id, $category->link_rewrite[(int) $id_lang]);
if ($version == 'es') {
$sale_link = str_replace('bebeboutik.com', 'bebeboutik.es', $sale_link);
}
$sql = '
SELECT `value`
@ -251,11 +281,13 @@ class Catalog
$this->_xml.='<sect_04>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<link>'.$link_sale.'</link>';
//$this->_xml .= '<description></description>';
//$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$sale_link.'</link>';
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
$this->_xml .= '<image>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]> <![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
$this->_xml .= '</image>';
@ -263,8 +295,9 @@ class Catalog
}
if (count($sale_current)%2 == 1){
$this->_xml.='<sect_04>';
$this->_xml .= '<title>></title>';
$this->_xml .= '<description>Bebeboutik.com</description>';
$this->_xml .= '<title></title>';
$this->_xml .= '<description><![CDATA['.$all_sales.']]></description>';
$this->_xml .= '<description></description>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$link_sale.'</link>';
$this->_xml .= '<reduction></reduction>';
@ -280,16 +313,21 @@ class Catalog
$link = new Link();
$category = new Category($item->id_category);
$sale_link = $link->getCategoryLink($category->id, $category->link_rewrite[(int) $id_lang]);
if ($version == 'es') {
$sale_link = str_replace('bebeboutik.com', 'bebeboutik.es', $sale_link);
}
$this->_xml.='<sect_03>';
// $this->_xml .= '<id_vente>'.$item->id.'</id_vente>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<description><![CDATA['.$item->description[(int) $id_lang].']]></description>';
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<link>'.$link_sale.'</link>';
//$this->_xml .= '<description></description>';
//$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$sale_link.'</link>';
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
$this->_xml .= '<image>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]> <![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
$this->_xml .= '</image>';
@ -297,8 +335,9 @@ class Catalog
}
if (count($sales_last_day)%2 == 1){
$this->_xml.='<sect_03>';
$this->_xml .= '<title>></title>';
$this->_xml .= '<description>Bebeboutik.com</description>';
$this->_xml .= '<title></title>';
$this->_xml .= '<description><![CDATA['.$all_sales.']]></description>';
$this->_xml .= '<description></description>';
$this->_xml .= '<category></category>';
$this->_xml .= '<link>'.$link_sale.'</link>';
$this->_xml .= '<reduction></reduction>';

View File

@ -968,11 +968,11 @@ $(document).ready(function () {
return (false);
}
//if (!(phone_mobile.test($('#custPhone').val()) || phone_mobile_be.test($('#custPhone').val()))) {
// ev.preventDefault();
// alert($('#error-mobile-invalid').val() + '\n\nFormat : 0661010203');
// return (false);
//}
if (!(phone_mobile.test($('#custPhone').val()) || phone_mobile_be.test($('#custPhone').val()))) {
ev.preventDefault();
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0661010203');
return (false);
}
return (true);
});

View File

@ -714,7 +714,7 @@ class soflexibilite extends CarrierModule
protected function savePreactivationRequest()
{
{
return;
/*if (version_compare(_PS_VERSION_, '1.5', '<')) {
@ -1567,7 +1567,7 @@ class soflexibilite extends CarrierModule
'address2' => $address['address2'],
'postcode' => $address['postcode'],
'city' => $address['city'],
'phone' => (!empty($address['phone_mobile'])?$address['phone_mobile']:$address['phone']),
'phone' => $address['phone_mobile'],
'country' => Country::getIsoById($address['id_country']),
'abdefault' => $address['id_address'] == (int)$params['cart']->id_address_delivery ? '1' : '0'
);
@ -1613,7 +1613,7 @@ class soflexibilite extends CarrierModule
'soflexibilite_a2p_id' => (int)$this->id_carrier_so['SOFLEXIBILITE_A2P_ID'],
'soflexibilite_cust_id' => $id_delivery_address,
'inputs' => $inputs,
'soflexibilite_mobile' => ((isset($mobile) && !empty($mobile))?$mobile:$address['phone']),
'soflexibilite_mobile' => $mobile,
'soflexibilite_point_list_url' => $this->point_list_url,
'getCustomerAddress' => $this->getCustomerAddress,
'saveDeliveryPoint' => $this->saveDelivery_url,

View File

@ -5107,3 +5107,12 @@ body#product div.sale_img img{
#product .product_info .info .pink{
color: #e36ea2;
}
h3.gift_title {
font-size: 13px;
margin-top: 20px;
}
#gift_div {
display: none;
line-height: 16px;
font-size: 13px;
}