first commit

This commit is contained in:
2024-11-11 18:46:54 +01:00
commit a630d17338
25634 changed files with 4923715 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
<?php
/**
* PRO Module to show VAT-free price with the price tax incl.
*
* @author Singleton software <info@singleton-software.com>
* @copyright 2018 Singleton software
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
class DualPriceDisplayProProductCombinationsModuleFrontController extends ModuleFrontController
{
public function __construct() {
parent::__construct();
}
public function initContent() {
parent::initContent();
}
public function displayAjaxGetProductCombinationPrice() {
if (Tools::getIsset('token')) {
$idProduct = (int)Tools::getValue('id_product');
$idProductAttribute = (Tools::getIsset('group') ? (int)self::getProductAttributesID((int)Tools::getValue('id_product'), Tools::getValue('group')) : 0);
$quantity = (int)Tools::getValue('qty');
} else {
$idProduct = (int)Tools::getValue('productID');
$idProductAttribute = (int)Tools::getValue('productAttributeID');
$quantity = (int)Tools::getValue('quantity');
}
$productPrice = array();
$productPrice['taxInclPrice'] = Tools::displayPrice(Product::getPriceStatic($idProduct, true, (($idProductAttribute > 0) ? $idProductAttribute : null), 6, null, false, true) * $quantity, $this->context->currency);
$productPrice['taxExclPrice'] = Tools::displayPrice(Product::getPriceStatic($idProduct, false, (($idProductAttribute > 0) ? $idProductAttribute : null), 6, null, false, true) * $quantity, $this->context->currency);
$productPrice['originalTaxInclPrice'] = Tools::displayPrice(Product::getPriceStatic($idProduct, true, (($idProductAttribute > 0) ? $idProductAttribute : null), 6, null, false, false) * $quantity, $this->context->currency);
$productPrice['originalTaxExclPrice'] = Tools::displayPrice(Product::getPriceStatic($idProduct, false, (($idProductAttribute > 0) ? $idProductAttribute : null), 6, null, false, false) * $quantity, $this->context->currency);
$productPrice['hasDiscount'] = ($productPrice['taxInclPrice'] < $productPrice['originalTaxInclPrice']);
die(Tools::jsonEncode(
array(
'productPriceInDetail' => $productPrice,
'productID' => $idProduct
)
));
}
public static function getProductAttributesID($productId, $groups) {
if (!is_array($groups)) {
return 0;
}
$productAttributeId = Db::getInstance()->getValue('
SELECT pac.`id_product_attribute`
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
INNER JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.id_product_attribute = pac.id_product_attribute
WHERE id_product = '.(int)$productId.' AND id_attribute IN ('.implode(',', array_map('intval', $groups)).')
GROUP BY id_product_attribute
HAVING COUNT(id_product) = '.count($groups));
if ($productAttributeId === false) {
$ordered = array();
$result = Db::getInstance()->executeS('SELECT `id_attribute` FROM `'._DB_PREFIX_.'attribute` a
INNER JOIN `'._DB_PREFIX_.'attribute_group` g ON a.`id_attribute_group` = g.`id_attribute_group`
WHERE `id_attribute` IN ('.implode(',', array_map('intval', $groups)).') ORDER BY g.`position` ASC');
foreach ($result as $row) {
$ordered[] = $row['id_attribute'];
}
while ($productAttributeId === false && count($ordered) > 0) {
array_pop($ordered);
$productAttributeId = Db::getInstance()->getValue('
SELECT pac.`id_product_attribute`
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
INNER JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.id_product_attribute = pac.id_product_attribute
WHERE id_product = '.(int)$productId.' AND id_attribute IN ('.implode(',', array_map('intval', $ordered)).')
GROUP BY id_product_attribute
HAVING COUNT(id_product) = '.count($ordered));
}
}
return $productAttributeId;
}
}

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;