コード例 #1
0
ファイル: blockcompare-ajax.php プロジェクト: redb/prestashop
<?php

global $cookie;
//call module
require_once dirname(__FILE__) . '/blockcompare.php';
$compare = new CompareCart(intval($cookie->id_compare));
$compare->id_lang = intval($cookie->id_lang);
$hookArgs = array();
$hookArgs['cookie'] = $cookie;
$hookArgs['compare'] = $compare;
//show module
$blockCompare = new BlockCompare();
echo $blockCompare->hookAjaxCall($hookArgs);
コード例 #2
0
ファイル: compare.php プロジェクト: redb/prestashop
<?php

include dirname(__FILE__) . '/../../debug.php';
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/blockcompare.php';
$errors = array();
$add = Tools::getIsset('add') ? 1 : 0;
$delete = Tools::getIsset('delete') ? 1 : 0;
$update = Tools::getIsset('update') ? 1 : 0;
$block = new BlockCompare();
$block->hookTop(array());
//update the compare_cart...
if ($add or $update or $delete) {
    //get the values
    $idProduct = intval(Tools::getValue('id_product', NULL));
    if (!$idProduct) {
        $errors[] = Tools::displayError('product not found');
    } else {
        $producToAdd = new Product(intval($idProduct), false, intval($cookie->id_lang));
        if ((!$producToAdd->id or !$producToAdd->active) and !$delete) {
            $errors[] = Tools::displayError('product is no longer available');
        } else {
            if ($add) {
                /* Product addition to the compare_cart */
                if (!isset($compare_cart->id) or !$compare_cart->id) {
                    $compare_cart->add();
                    if ($compare_cart->id) {
                        $cookie->id_compare_cart = intval($compare_cart->id);
                    }
                }
コード例 #3
0
ファイル: CompareCart.php プロジェクト: redb/prestashop
<?php

include dirname(__FILE__) . '/../../debug.php';
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/blockcompare.php';
$errors = array();
Tools::safePostVars();
include_once dirname(__FILE__) . '/../../header.php';
include dirname(__FILE__) . '/../../debug-style.php';
$m = new BlockCompare();
$m->hookTop(array());
$products = $compare_cart->getProducts();
$smarty->assign(array('products' => $products));
$features = array();
foreach ($products as $product) {
    $product = new Product($product['id']);
    $product_features = $product->getFrontFeatures(intval($cookie->id_lang));
    foreach ($product_features as $product_feature) {
        if (!isset($features[$product_feature['name']])) {
            $features[$product_feature['name']] = array();
        }
        $features[$product_feature['name']][$product->id] = $product_feature['value'];
    }
}
$smarty->assign(array('features' => $features));
$block = new BlockCompare();
echo $block->display(dirname(__FILE__) . '/blockcompare.php', 'comparecart.tpl');
include_once dirname(__FILE__) . '/../../footer.php';