feat(cart): Add border and background color to cart table
This commit is contained in:
@@ -55,68 +55,36 @@ foreach ( $products_array as $product )
|
|||||||
$price = 0; // jeśli są kombinacje, to cena jest 0
|
$price = 0; // jeśli są kombinacje, to cena jest 0
|
||||||
|
|
||||||
$reference = $product['ean'];
|
$reference = $product['ean'];
|
||||||
$id_tax_rules_group = 1 ; // ID grupy reguł podatkowych
|
$active = 0; // Ustawienie produktu jako nieaktywny
|
||||||
$active = 1; // Ustawienie produktu jako nieaktywny
|
|
||||||
$sql = 'UPDATE `' . _DB_PREFIX_ . 'product`
|
|
||||||
SET `price` = ' . (float)$price . ',
|
|
||||||
`id_tax_rules_group` = ' . (int)$id_tax_rules_group . ',
|
|
||||||
`active` = ' . (int)$active . '
|
|
||||||
WHERE `reference` = \'' . pSQL($reference) . '\'';
|
|
||||||
$result = Db::getInstance()->execute($sql);
|
|
||||||
|
|
||||||
$result = Db::getInstance()->executeS('SELECT id_product FROM `' . _DB_PREFIX_ . 'product` WHERE `reference` = \'' . pSQL($reference) . '\'');
|
// table `materac_product`
|
||||||
|
if ( $reference )
|
||||||
// $id_product może być tablicą
|
|
||||||
if ( is_array( $result ) )
|
|
||||||
{
|
{
|
||||||
foreach ( $result as $id )
|
$sql = 'UPDATE `' . _DB_PREFIX_ . 'product` SET `price` = ' . (float)$price . ', `active` = ' . (int)$active . ' WHERE `reference` = \'' . pSQL($reference) . '\'';
|
||||||
|
$result = Db::getInstance()->execute($sql);
|
||||||
|
// table `materac_product_shop`
|
||||||
|
$products_ids = Db::getInstance()->executeS('SELECT id_product FROM `' . _DB_PREFIX_ . 'product` WHERE `reference` = \'' . pSQL($reference) . '\'');
|
||||||
|
foreach ( $products_ids as $id )
|
||||||
{
|
{
|
||||||
// update materac_product_shop where id_product = id_product
|
$sql_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_shop` SET `price` = ' . (float)$price . ', `active` = ' . (int)$active . ' WHERE `id_product` = ' . (int)$id['id_product'];
|
||||||
$sql_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_shop`
|
|
||||||
SET `price` = ' . (float)$price . ',
|
|
||||||
`id_tax_rules_group` = ' . (int)$id_tax_rules_group . ',
|
|
||||||
`active` = ' . (int)$active . '
|
|
||||||
WHERE `id_product` = ' . $id['id_product'];
|
|
||||||
$result_shop = Db::getInstance()->execute($sql_shop);
|
$result_shop = Db::getInstance()->execute($sql_shop);
|
||||||
echo "Zaktualizowano produkt z referencją $reference, id_product: " . $id['id_product'] . ", cena: $price, id_tax_rules_group: $id_tax_rules_group, active: $active<br>";
|
echo "Zaktualizowano produkt z referencją $reference, id_product: " . $id['id_product'] . ", cena: $price, active: $active<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// update materac_product_shop where id_product = id_product
|
|
||||||
$sql_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_shop`
|
|
||||||
SET `price` = ' . (float)$price . ',
|
|
||||||
`id_tax_rules_group` = ' . (int)$id_tax_rules_group . ',
|
|
||||||
`active` = ' . (int)$active . '
|
|
||||||
WHERE `id_product` = ' . (int)$result;
|
|
||||||
$result_shop = Db::getInstance()->execute($sql_shop);
|
|
||||||
if ( !$result_shop )
|
|
||||||
echo "Zaktualizowano produkt z referencją $reference, id_product: $result, cena: $price, id_tax_rules_group: $id_tax_rules_group, active: $active<br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// update materac_product_attribute by reference
|
|
||||||
foreach ( $product['combinations'] as $combination )
|
foreach ( $product['combinations'] as $combination )
|
||||||
{
|
{
|
||||||
$sql_combination = 'UPDATE `' . _DB_PREFIX_ . 'product_attribute`
|
$sql_combination = 'UPDATE `' . _DB_PREFIX_ . 'product_attribute` SET `price` = ' . (float)$combination['price'] . ' WHERE `reference` = \'' . pSQL($combination['ean']) . '\'';
|
||||||
SET `price` = ' . (float)$combination['price'] . '
|
|
||||||
WHERE `reference` = \'' . pSQL($combination['ean']) . '\'';
|
|
||||||
$result_combination = Db::getInstance()->execute($sql_combination);
|
$result_combination = Db::getInstance()->execute($sql_combination);
|
||||||
|
|
||||||
// get id_product_attribute from materac_product_attribute where reference = KodEAN-13
|
$combination_ids = Db::getInstance()->executeS('SELECT id_product_attribute FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `reference` = \'' . pSQL($combination['ean']) . '\'');
|
||||||
$id_product_attribute = Db::getInstance()->getValue('SELECT id_product_attribute FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `reference` = \'' . pSQL($combination['ean']) . '\'');
|
foreach ( $combination_ids as $id_combination )
|
||||||
if ( !$result_combination )
|
|
||||||
{
|
{
|
||||||
echo "Error: Cannot update product attribute with reference " . $combination['ean'] . "<br>";
|
$sql_combination_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_attribute_shop` SET `price` = ' . (float)$combination['price'] . ' WHERE `id_product_attribute` = ' . (int)$id_combination['id_product_attribute'];
|
||||||
continue;
|
$result_combination_shop = Db::getInstance()->execute($sql_combination_shop);
|
||||||
|
echo "Zaktualizowano kombinację z referencją " . $combination['ean'] . ", id_product_attribute: " . $id_combination['id_product_attribute'] . ", cena: " . $combination['price'] . "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// update materac_product_attribute_shop where id_product_attribute = id_product_attribute
|
|
||||||
$sql_combination_shop = 'UPDATE `' . _DB_PREFIX_ . 'product_attribute_shop`
|
|
||||||
SET `price` = ' . (float)$combination['price'] . '
|
|
||||||
WHERE `id_product_attribute` = ' . (int)$id_product_attribute;
|
|
||||||
$result_combination_shop = Db::getInstance()->execute($sql_combination_shop);
|
|
||||||
}
|
}
|
||||||
echo "Zaktualizowano kombinacje dla produktu z referencją $reference<br>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@@ -1341,6 +1341,8 @@ body#cart {
|
|||||||
|
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
border: 1px solid #110e0c1a;
|
||||||
|
background: gray;
|
||||||
|
|
||||||
thead {
|
thead {
|
||||||
&::after {
|
&::after {
|
||||||
|
|||||||
Reference in New Issue
Block a user