Exemplo n.º 1
0
/**
 * Prepare and sends products data to update buyer info.
 * event - save_cart
 *
 * @return bool
 */
function fn_triggmine_save_cart($cart, $user_id, $type)
{
    if (isset($cart['products'])) {
        $products = $cart['products'];
        $items = array();
        foreach ($products as $product) {
            $item = array();
            $ImageInfo = fn_get_cart_product_icon($product['product_id']);
            $item['CartItemId'] = $product['product_id'];
            $item['Title'] = $product['product'];
            $item['Count'] = $product['amount'];
            $item['Price'] = $product['price'];
            $product_data = fn_get_product_data($product['product_id'], $_SESSION['auth']);
            if (isset($product_data['meta_description'])) {
                $item['Description'] = $product_data['meta_description'];
            }
            if (isset($ImageInfo['detailed'])) {
                $ImageUrl = $ImageInfo['detailed']['http_image_path'];
                $item['ImageUrl'] = $ImageUrl;
            }
            //TODO add ThumbnailUrl
            /*if (isset($item['ThumbnailUrl'])) {
                  $ImageThumbnailUrl = path to ThumbnailUrl;
              }*/
            $items['Items'][] = $item;
        }
        $integrator = Triggmine_Integrator_CS_Cart::singleton();
        $integrator->_onCartFullUpdate($items);
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 2
0
 $prev_wishlist = $wishlist['products'];
 //echo var_dump($_REQUEST['product_data']);die();
 $product_ids = fn_add_product_to_wishlist($_REQUEST['product_data'], $wishlist, $auth);
 fn_save_cart_content($wishlist, $auth['user_id'], 'W');
 $added_products = array_diff_assoc($wishlist['products'], $prev_wishlist);
 //var_dump(defined('AJAX_REQUEST'));die();
 if (defined('AJAX_REQUEST')) {
     if (!empty($added_products)) {
         foreach ($added_products as $key => $data) {
             $product = fn_get_product_data($data['product_id'], $auth);
             $product['extra'] = !empty($data['extra']) ? $data['extra'] : array();
             fn_gather_additional_product_data($product, true, true);
             $added_products[$key]['product_option_data'] = fn_get_selected_product_options_info($data['product_options']);
             $added_products[$key]['display_price'] = $product['price'];
             $added_products[$key]['amount'] = empty($data['amount']) ? 1 : $data['amount'];
             $added_products[$key]['main_pair'] = fn_get_cart_product_icon($data['product_id'], $data);
         }
         Registry::get('view')->assign('added_products', $added_products);
         if (Registry::get('settings.General.allow_anonymous_shopping') == 'hide_price_and_add_to_cart') {
             Registry::get('view')->assign('hide_amount', true);
         }
         $title = __('product_added_to_wl');
         $msg = Registry::get('view')->fetch('addons/wishlist/views/wishlist/components/product_notification.tpl');
         fn_set_notification('I', $title, $msg, 'I');
     } else {
         if ($product_ids) {
             fn_set_notification('W', __('notice'), __('product_in_wishlist'));
         }
     }
     $product_ids = fn_add_product_to_wishlist($_REQUEST['product_data'], $wishlist, $auth);
     fn_save_cart_content($wishlist, $auth['user_id'], 'W');
Exemplo n.º 3
0
function fn_reorder($order_id, &$cart, &$auth)
{
    $order_info = fn_get_order_info($order_id, false, false, false, true);
    unset($_SESSION['shipping_hash']);
    unset($_SESSION['edit_step']);
    fn_set_hook('reorder', $order_info, $cart, $auth);
    foreach ($order_info['products'] as $k => $item) {
        // refresh company id
        $company_id = db_get_field("SELECT company_id FROM ?:products WHERE product_id = ?i", $item['product_id']);
        $order_info['products'][$k]['company_id'] = $company_id;
        unset($order_info['products'][$k]['extra']['ekey_info']);
        $order_info['products'][$k]['product_options'] = empty($order_info['products'][$k]['extra']['product_options']) ? array() : $order_info['products'][$k]['extra']['product_options'];
        $order_info['products'][$k]['main_pair'] = fn_get_cart_product_icon($item['product_id'], $order_info['products'][$k]);
    }
    if (!empty($cart) && !empty($cart['products'])) {
        $cart['products'] = fn_array_merge($cart['products'], $order_info['products']);
    } else {
        $cart['products'] = $order_info['products'];
    }
    foreach ($cart['products'] as $k => $v) {
        $_is_edp = db_get_field("SELECT is_edp FROM ?:products WHERE product_id = ?i", $v['product_id']);
        if ($amount = fn_check_amount_in_stock($v['product_id'], $v['amount'], $v['product_options'], $k, $_is_edp, 0, $cart)) {
            $cart['products'][$k]['amount'] = $amount;
            // Change the path of custom files
            if (!empty($v['extra']['custom_files'])) {
                foreach ($v['extra']['custom_files'] as $option_id => $_data) {
                    if (!empty($_data)) {
                        foreach ($_data as $file_id => $file) {
                            $cart['products'][$k]['extra']['custom_files'][$option_id][$file_id]['path'] = 'sess_data/' . fn_basename($file['path']);
                        }
                    }
                }
            }
        } else {
            unset($cart['products'][$k]);
        }
    }
    // Restore custom files for editing
    $dir_path = 'order_data/' . $order_id;
    if (Storage::instance('custom_files')->isExist($dir_path)) {
        Storage::instance('custom_files')->copy($dir_path, 'sess_data');
    }
    // Redirect customer to step three after reordering
    $cart['payment_updated'] = true;
    fn_save_cart_content($cart, $auth['user_id']);
    unset($cart['product_groups']);
}
Exemplo n.º 4
0
function fn_add_product_to_cart($product_data, &$cart, &$auth, $update = false)
{
    $ids = array();
    if (!empty($product_data) && is_array($product_data)) {
        if (!defined('GET_OPTIONS')) {
            list($product_data, $cart) = fn_add_product_options_files($product_data, $cart, $auth, $update);
        }
        fn_set_hook('pre_add_to_cart', $product_data, $cart, $auth, $update);
        foreach ($product_data as $key => $data) {
            if (empty($key)) {
                continue;
            }
            if (empty($data['amount'])) {
                continue;
            }
            $data['stored_price'] = !empty($data['stored_price']) && defined('ORDER_MANAGEMENT') ? $data['stored_price'] : 'N';
            if (empty($data['extra'])) {
                $data['extra'] = array();
            }
            $product_id = !empty($data['product_id']) ? intval($data['product_id']) : intval($key);
            if (!fn_check_add_product_to_cart($cart, $data, $product_id)) {
                continue;
            }
            // Check if product options exist
            if (!isset($data['product_options'])) {
                $data['product_options'] = fn_get_default_product_options($product_id);
            }
            // Generate cart id
            $data['extra']['product_options'] = $data['product_options'];
            $_id = fn_generate_cart_id($product_id, $data['extra'], false);
            if (isset($ids[$_id]) && $key == $_id) {
                continue;
            }
            if (isset($data['extra']['exclude_from_calculate'])) {
                if (!empty($cart['products'][$key]) && !empty($cart['products'][$key]['extra']['aoc'])) {
                    $cart['saved_product_options'][$cart['products'][$key]['extra']['saved_options_key']] = $data['product_options'];
                }
                if (isset($cart['deleted_exclude_products'][$data['extra']['exclude_from_calculate']][$_id])) {
                    continue;
                }
            }
            $amount = fn_normalize_amount(@$data['amount']);
            if (!isset($data['extra']['exclude_from_calculate'])) {
                if ($data['stored_price'] != 'Y') {
                    $allow_add = true;
                    // Check if the product price with options modifiers equals to zero
                    $price = fn_get_product_price($product_id, $amount, $auth);
                    $zero_price_action = db_get_field("SELECT zero_price_action FROM ?:products WHERE product_id = ?i", $product_id);
                    if (!floatval($price) && $zero_price_action == 'A') {
                        if (isset($cart['products'][$key]['custom_user_price'])) {
                            $price = $cart['products'][$key]['custom_user_price'];
                        } else {
                            $custom_user_price = empty($data['price']) ? 0 : $data['price'];
                        }
                    }
                    $price = fn_apply_options_modifiers($data['product_options'], $price, 'P', array(), array('product_data' => $data));
                    if (!floatval($price)) {
                        $data['price'] = isset($data['price']) ? fn_parse_price($data['price']) : 0;
                        if (($zero_price_action == 'R' || $zero_price_action == 'A' && floatval($data['price']) < 0) && AREA == 'C') {
                            if ($zero_price_action == 'A') {
                                fn_set_notification('E', __('error'), __('incorrect_price_warning'));
                            }
                            $allow_add = false;
                        }
                        $price = empty($data['price']) ? 0 : $data['price'];
                    }
                    /**
                     * Recalculates price and checks if product can be added with the current price
                     *
                     * @param array $data Adding product data
                     * @param float $price Calculated product price
                     * @param boolean $allow_add Flag that determines if product can be added to cart
                     */
                    fn_set_hook('add_product_to_cart_check_price', $data, $price, $allow_add);
                    if (!$allow_add) {
                        continue;
                    }
                } else {
                    $price = empty($data['price']) ? 0 : $data['price'];
                }
            } else {
                $price = 0;
            }
            $_data = db_get_row('SELECT is_edp, options_type, tracking, unlimited_download FROM ?:products WHERE product_id = ?i', $product_id);
            if (isset($_data['is_edp'])) {
                $data['is_edp'] = $_data['is_edp'];
            } elseif (!isset($data['is_edp'])) {
                $data['is_edp'] = 0;
            }
            if (isset($_data['options_type'])) {
                $data['options_type'] = $_data['options_type'];
            }
            if (isset($_data['tracking'])) {
                $data['tracking'] = $_data['tracking'];
            }
            if (isset($_data['unlimited_download'])) {
                $data['extra']['unlimited_download'] = $_data['unlimited_download'];
            }
            // Check the sequential options
            if (!empty($data['tracking']) && $data['tracking'] == ProductTracking::TRACK_WITH_OPTIONS && $data['options_type'] == 'S') {
                $inventory_options = db_get_fields("SELECT a.option_id FROM ?:product_options as a LEFT JOIN ?:product_global_option_links as c ON c.option_id = a.option_id WHERE (a.product_id = ?i OR c.product_id = ?i) AND a.status = 'A' AND a.inventory = 'Y'", $product_id, $product_id);
                $sequential_completed = true;
                if (!empty($inventory_options)) {
                    foreach ($inventory_options as $option_id) {
                        if (!isset($data['product_options'][$option_id]) || empty($data['product_options'][$option_id])) {
                            $sequential_completed = false;
                            break;
                        }
                    }
                }
                if (!$sequential_completed) {
                    fn_set_notification('E', __('error'), __('select_all_product_options'));
                    // Even if customer tried to add the product from the catalog page, we will redirect he/she to the detailed product page to give an ability to complete a purchase
                    $redirect_url = fn_url('products.view?product_id=' . $product_id . '&combination=' . fn_get_options_combination($data['product_options']));
                    $_REQUEST['redirect_url'] = $redirect_url;
                    //FIXME: Very very very BAD style to use the global variables in the functions!!!
                    return false;
                }
            }
            if (!isset($cart['products'][$_id])) {
                // If product doesn't exists in the cart
                $amount = empty($data['original_amount']) ? fn_check_amount_in_stock($product_id, $amount, $data['product_options'], $_id, $data['is_edp'], 0, $cart, $update == true ? $key : 0) : $data['original_amount'];
                if ($amount === false) {
                    continue;
                }
                $cart['products'][$_id]['product_id'] = $product_id;
                $cart['products'][$_id]['product_code'] = fn_get_product_code($product_id, $data['product_options']);
                $cart['products'][$_id]['product'] = fn_get_product_name($product_id);
                $cart['products'][$_id]['amount'] = $amount;
                $cart['products'][$_id]['product_options'] = $data['product_options'];
                $cart['products'][$_id]['price'] = $price;
                if (!empty($zero_price_action) && $zero_price_action == 'A') {
                    if (isset($custom_user_price)) {
                        $cart['products'][$_id]['custom_user_price'] = $custom_user_price;
                    } elseif (isset($cart['products'][$key]['custom_user_price'])) {
                        $cart['products'][$_id]['custom_user_price'] = $cart['products'][$key]['custom_user_price'];
                    }
                }
                $cart['products'][$_id]['stored_price'] = $data['stored_price'];
                // add image for minicart
                $cart['products'][$_id]['main_pair'] = fn_get_cart_product_icon($product_id, $data);
                fn_define_original_amount($product_id, $_id, $cart['products'][$_id], $data);
                if ($update == true && $key != $_id) {
                    fn_delete_cart_product($cart, $key, false);
                }
            } else {
                // If product is already exist in the cart
                $_initial_amount = empty($cart['products'][$_id]['original_amount']) ? $cart['products'][$_id]['amount'] : $cart['products'][$_id]['original_amount'];
                // If ID changed (options were changed), summ the total amount of old and new products
                if ($update == true && $key != $_id) {
                    $amount += $_initial_amount;
                    fn_delete_cart_product($cart, $key, false);
                }
                $cart['products'][$_id]['amount'] = fn_check_amount_in_stock($product_id, ($update == true ? 0 : $_initial_amount) + $amount, $data['product_options'], $_id, !empty($data['is_edp']) && $data['is_edp'] == 'Y' ? 'Y' : 'N', 0, $cart, $update == true ? $key : 0);
            }
            $cart['products'][$_id]['extra'] = empty($data['extra']) ? array() : $data['extra'];
            $cart['products'][$_id]['stored_discount'] = @$data['stored_discount'];
            if (defined('ORDER_MANAGEMENT')) {
                $cart['products'][$_id]['discount'] = @$data['discount'];
            }
            // Increase product popularity
            if (empty($_SESSION['products_popularity']['added'][$product_id])) {
                $_data = array('product_id' => $product_id, 'added' => 1, 'total' => POPULARITY_ADD_TO_CART);
                db_query("INSERT INTO ?:product_popularity ?e ON DUPLICATE KEY UPDATE added = added + 1, total = total + ?i", $_data, POPULARITY_ADD_TO_CART);
                $_SESSION['products_popularity']['added'][$product_id] = true;
            }
            $company_id = db_get_field("SELECT company_id FROM ?:products WHERE product_id = ?i", $product_id);
            $cart['products'][$_id]['company_id'] = $company_id;
            if (!empty($data['saved_object_id'])) {
                $cart['products'][$_id]['object_id'] = $data['saved_object_id'];
            }
            fn_set_hook('add_to_cart', $cart, $product_id, $_id);
            $ids[$_id] = $product_id;
        }
        /**
         * Change product data after adding product to cart
         *
         * @param array $product_data Product data
         * @param array $cart Cart data
         * @param array $auth Auth data
         * @param bool $update Flag the determains if cart data are updated
         */
        fn_set_hook('post_add_to_cart', $product_data, $cart, $auth, $update, $ids);
        $cart['recalculate'] = true;
        if (!empty($cart['chosen_shipping'])) {
            $cart['calculate_shipping'] = true;
            unset($cart['product_groups']);
        }
        return $ids;
    } else {
        return false;
    }
}
Exemplo n.º 5
0
 }
 if (isset($order_info['need_shipping']) && $order_info['need_shipping']) {
     $company_id = !empty($order_info['company_id']) ? $order_info['company_id'] : null;
     $shippings = fn_get_available_shippings($company_id);
     Registry::get('view')->assign('shippings', $shippings);
 }
 Registry::set('navigation.tabs', array('general' => array('title' => __('general'), 'js' => true), 'addons' => array('title' => __('addons'), 'js' => true)));
 if (fn_allowed_for('MULTIVENDOR')) {
     Registry::get('view')->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($order_info['products']));
 }
 $downloads_exist = false;
 foreach ($order_info['products'] as $k => $v) {
     if (!$downloads_exist && !empty($v['extra']['is_edp']) && $v['extra']['is_edp'] == 'Y') {
         $downloads_exist = true;
     }
     $order_info['products'][$k]['main_pair'] = fn_get_cart_product_icon($v['product_id'], $order_info['products'][$k]);
 }
 if ($downloads_exist) {
     Registry::set('navigation.tabs.downloads', array('title' => __('downloads'), 'js' => true));
     Registry::get('view')->assign('downloads_exist', true);
 }
 if (!empty($order_info['promotions'])) {
     Registry::set('navigation.tabs.promotions', array('title' => __('promotions'), 'js' => true));
 }
 list($shipments) = fn_get_shipments_info(array('order_id' => $params['order_id'], 'advanced_info' => true));
 $use_shipments = !fn_one_full_shipped($shipments);
 // Check for the shipment access
 // If current edition is FREE, we still need to check shipments accessibility (need to display promotion link)
 if (Settings::instance()->getValue('use_shipments', '', $order_info['company_id']) == 'Y') {
     if (!fn_check_user_access($auth['user_id'], 'edit_order')) {
         $order_info['need_shipment'] = false;
Exemplo n.º 6
0
function fn_reorder($order_id, &$cart, &$auth)
{
    $order_info = fn_get_order_info($order_id, false, false, false, true);
    unset(Tygh::$app['session']['shipping_hash']);
    unset(Tygh::$app['session']['edit_step']);
    fn_set_hook('reorder', $order_info, $cart, $auth);
    foreach ($order_info['products'] as $k => $item) {
        // refresh company id
        $company_id = db_get_field("SELECT company_id FROM ?:products WHERE product_id = ?i", $item['product_id']);
        $order_info['products'][$k]['company_id'] = $company_id;
        unset($order_info['products'][$k]['extra']['ekey_info']);
        unset($order_info['products'][$k]['extra']['promotions']);
        unset($order_info['products'][$k]['promotions']);
        $order_info['products'][$k]['product_options'] = empty($order_info['products'][$k]['extra']['product_options']) ? array() : $order_info['products'][$k]['extra']['product_options'];
        $order_info['products'][$k]['main_pair'] = fn_get_cart_product_icon($item['product_id'], $order_info['products'][$k]);
    }
    if (!empty($cart) && !empty($cart['products'])) {
        $cart['products'] = fn_array_merge($cart['products'], $order_info['products']);
    } else {
        $cart['products'] = $order_info['products'];
    }
    foreach ($cart['products'] as $k => $v) {
        $_is_edp = db_get_field("SELECT is_edp FROM ?:products WHERE product_id = ?i", $v['product_id']);
        if ($amount = fn_check_amount_in_stock($v['product_id'], $v['amount'], $v['product_options'], $k, $_is_edp, 0, $cart)) {
            $cart['products'][$k]['amount'] = $amount;
            // Check if the product price with options modifiers equals to zero
            $price = fn_get_product_price($v['product_id'], $amount, $auth);
            $zero_price_action = db_get_field("SELECT zero_price_action FROM ?:products WHERE product_id = ?i", $v['product_id']);
            if (!floatval($price) && $zero_price_action == 'A') {
                if (isset($v['custom_user_price'])) {
                    $price = $v['custom_user_price'];
                }
            }
            $price = fn_apply_options_modifiers($v['product_options'], $price, 'P', array(), array('product_data' => $v));
            if (!floatval($price)) {
                $data['price'] = isset($data['price']) ? fn_parse_price($data['price']) : 0;
                if (AREA == 'C' && ($zero_price_action == 'R' || $zero_price_action == 'A' && floatval($data['price']) < 0)) {
                    if ($zero_price_action == 'A') {
                        fn_set_notification('E', __('error'), __('incorrect_price_warning'));
                    } else {
                        fn_set_notification('W', __('warning'), __('warning_zero_price_restricted_product', array('[product]' => $v['product'])));
                    }
                    unset($cart['products'][$k]);
                    continue;
                }
            }
            // Change the path of custom files
            if (!empty($v['extra']['custom_files'])) {
                foreach ($v['extra']['custom_files'] as $option_id => $_data) {
                    if (!empty($_data)) {
                        foreach ($_data as $file_id => $file) {
                            $cart['products'][$k]['extra']['custom_files'][$option_id][$file_id]['path'] = 'sess_data/' . fn_basename($file['path']);
                        }
                    }
                }
            }
        } else {
            unset($cart['products'][$k]);
        }
    }
    // Restore custom files for editing
    $dir_path = 'order_data/' . $order_id;
    if (Storage::instance('custom_files')->isExist($dir_path)) {
        Storage::instance('custom_files')->copy($dir_path, 'sess_data');
    }
    // Redirect customer to step three after reordering
    $cart['payment_updated'] = true;
    fn_save_cart_content($cart, $auth['user_id']);
    unset($cart['product_groups']);
}
Exemplo n.º 7
0
function ls_minicart_generate_markup($ls_cart_product, $hash)
{
    $base_url = fn_ls_get_base_url();
    //get thumbnail path
    //   $image_relative_path = fn_get_image_pairs($ls_cart_product['product_id'], 'product', 'M', true, true, CART_LANGUAGE);
    //    $image_relative_path=$image_relative_path['detailed']['relative_path'];
    $image_relative_path = fn_get_cart_product_icon($ls_cart_product['product_id'], $ls_cart_product, true);
    $image_relative_path = $image_relative_path['detailed']['relative_path'];
    $thumbnail_path = fn_generate_thumbnail($image_relative_path, 120, null, false);
    if (!empty($thumbnail_path)) {
        $ls_product_image = "<img class='ty-pict' src='{$thumbnail_path}'>";
    } else {
        $ls_product_image = "<span class='ty-no-image' style='min-width: 120px; min-height: 168px;'><i class='ty-no-image__icon ty-icon-image'></i></span>";
    }
    //format price
    $ls_product_price = $ls_cart_product['price'];
    $ls_product_price = fn_format_price_by_currency($ls_product_price);
    //generate product options
    $ls_cart_options = "";
    foreach ($ls_cart_product['ls_minicart_options'] as $k => $option) {
        if ($_SESSION['settings']['cart_languageC']['value'] === 'en') {
            if (isset($option[0]['variant_name'])) {
                $ls_cart_options = $ls_cart_options . "<span class='ty-product-options clearfix'>\n                <span class='ty-product-options-name ls_minicart_option_name'>{$option[0]['option_name']}:&nbsp;</span>\n                <span class='ty-product-options-content ls_minicart_variant_name'>{$option[0]['variant_name']}&nbsp;</span>\n                </span>";
            }
        } else {
            if (isset($option[1]['variant_name'])) {
                $ls_cart_options = $ls_cart_options . "<span class='ty-product-options clearfix'>\n                <span class='ty-product-options-name ls_minicart_option_name'>{$option[1]['option_name']}:&nbsp;</span>\n                <span class='ty-product-options-content ls_minicart_variant_name'>{$option[1]['variant_name']}&nbsp;</span>\n                </span>";
            }
        }
    }
    //generate product options
    //$ls_move_form_options="<span class='ls_move_to_wishlist'>add_to_wishlist</span>";
    $ls_move_form_options = "<input type='hidden' name='product_data[{$ls_cart_product['product_id']}][product_id]' value='{$ls_cart_product['product_id']}'>";
    $ls_move_form_options .= "<input type='hidden' name='ls_move_to' value='wishlist'>";
    $ls_move_form_options .= "<input type='hidden' name='ls_cart_combination_hash' value='{$hash}'>";
    foreach ($ls_cart_product['product_options'] as $option_id => $option) {
        $ls_move_form_options .= "<input type='hidden' name='product_data[{$ls_cart_product['product_id']}][product_options][{$option_id}]' value='{$option}'>";
    }
    $ls_move_form_options .= "<span class='ls_move_to_wishlist'>add_to_wishlist</span>";
    //return the html
    if (!empty($ls_cart_product['product_options'])) {
        $markup = "<li class='ty-cart-items__list-item'>\n            <span style='display: none' class='ls_cart_combination_hash'>{$hash}</span>\n            <span style='display: none' class='ls_cart_combination_id'>{$ls_cart_product['product_id']}</span>\n            <div class='ty-cart-items__list-item-desc'>\n                <a href='{$base_url}/?dispatch=products.view?product_id={$ls_cart_product['product_id']}&wishlist_id={$hash}'>{$ls_cart_product['product']}</a>\n                <p>\n                    <span class='ls_cart_product_amount'>{$ls_cart_product['amount']}</span><span>&nbsp;x&nbsp;</span><span>{$ls_product_price}</span>\n                </p>\n                <div class='row-fluid'>\n                    <span class='span4'>\n                        <div class='ty-cart-items__list-item-image ls_cart_product_image'>\n                            {$ls_product_image}\n                        </div>\n                    </span>\n                            <form class='ls_move_to_wishlist_form'>\n                                {$ls_move_form_options}\n                            </form>\n                    <!--div class='ls_cart_options'-->\n                    <span class='span8'>\n                        <div class='ty-control-group ty-product-options__info clearfix'>\n                        <!--div class='ls_cart_options_title'--><label class='ty-product-options__title'>Optiuni:</label><!--/div-->                                    \n                       {$ls_cart_options}\n                        </div>\n                    </span>\n                    <!--/div-->\n                <div/>\n            </div>\n                <div class='ty-cart-items__list-item-tools cm-cart-item-delete'>\n                        <a data-ca-dispatch='delete_cart_item' href='{$base_url}/index.php?dispatch=checkout.delete.from_status&amp;cart_id={$hash}' class='cm-ajax ls_delete_icon' data-ca-target-id='cart_status*'><i title='Ştergeţi' class='ty-icon-cancel-circle'></i></a>\n                </div>\n        </li>";
    } else {
        $markup = "<li class='ty-cart-items__list-item'>\n            <span style='display: none' class='ls_cart_combination_hash'>{$hash}</span>\n            <span style='display: none' class='ls_cart_combination_id'>{$ls_cart_product['product_id']}</span>\n            <div class='ty-cart-items__list-item-desc'>\n                <a href='{$base_url}/?dispatch=products.view?product_id={$ls_cart_product['product_id']}&wishlist_id={$hash}'>{$ls_cart_product['product']}</a>\n                <p>\n                    <span class='ls_cart_product_amount'>{$ls_cart_product['amount']}</span><span>&nbsp;x&nbsp;</span><span>{$ls_product_price}</span>\n                </p>\n                <div class='row-fluid'>\n                <span class='span4'>\n                    <div class='ty-cart-items__list-item-image'>\n                        {$ls_product_image}\n                    </div>\n                </span>\n                <form class='ls_move_to_wishlist_form'>\n                                {$ls_move_form_options}\n                </form>\n                <span class='span8'>\n                    <!--div class='ls_cart_options'-->\n                        <div class='ty-control-group ty-product-options__info clearfix'>\n                        </div>\n                    <!--/div-->\n                </span>    \n                </div>\n            </div>\n                <div class='ty-cart-items__list-item-tools cm-cart-item-delete'>\n                        <a data-ca-dispatch='delete_cart_item' href='{$base_url}/index.php?dispatch=checkout.delete.from_status&amp;cart_id={$hash}' class='cm-ajax ls_delete_icon' data-ca-target-id='cart_status*'><i title='Ştergeţi' class='ty-icon-cancel-circle'></i></a>\n                </div>\n        </li>";
    }
    return $markup;
}
Exemplo n.º 8
0
    }
    return array(CONTROLLER_STATUS_OK);
}
// Add product to comparison list
if ($mode == 'add_product') {
    if (empty($_SESSION['comparison_list'])) {
        $_SESSION['comparison_list'] = array();
    }
    $p_id = $_REQUEST['product_id'];
    if (!in_array($p_id, $_SESSION['comparison_list'])) {
        array_unshift($_SESSION['comparison_list'], $p_id);
        $added_products = array();
        $added_products[$p_id]['product_id'] = $p_id;
        $added_products[$p_id]['display_price'] = fn_get_product_price($p_id, 1, $_SESSION['auth']);
        $added_products[$p_id]['amount'] = 1;
        $added_products[$p_id]['main_pair'] = fn_get_cart_product_icon($p_id);
        Registry::get('view')->assign('added_products', $added_products);
        $title = __('product_added_to_cl');
        $msg = Registry::get('view')->fetch('views/product_features/components/product_notification.tpl');
        fn_set_notification('I', $title, $msg, 'I');
    } else {
        fn_set_notification('W', __('notice'), __('product_in_compare_list'));
    }
    return array(CONTROLLER_STATUS_REDIRECT);
} elseif ($mode == 'clear_list') {
    unset($_SESSION['comparison_list']);
    unset($_SESSION['excluded_features']);
    if (defined('AJAX_REQUEST')) {
        Registry::get('view')->assign('compared_products', array());
        Registry::get('view')->display('blocks/static_templates/feature_comparison.tpl');
        exit;
Exemplo n.º 9
0
        $cart['recalculate'] = true;
        fn_calculate_cart_content($cart, $auth, 'A', true, 'F', true);
    } else {
        //   echo 'bad request';
    }
    exit;
} elseif ($mode == 'ls_generate_wishlist_markup') {
    $base_url = fn_ls_get_base_url();
    //changed parameters correction
    $_REQUEST['ls_productId'] = reset(array_keys($_REQUEST['product_data']));
    $_REQUEST['current_url'] = $_REQUEST["redirect_url"];
    $_REQUEST['ls_cart_combination_hash'] = $_REQUEST['ls_product_combination_hash'];
    //get thumbnail path
    //  $image_relative_path = fn_get_image_pairs($_REQUEST['ls_productId'], 'product', 'M', true, true, CART_LANGUAGE);
    //  $image_relative_path=$image_relative_path['detailed']['relative_path'];
    $image_relative_path = fn_get_cart_product_icon($_REQUEST['ls_productId'], $_REQUEST['product_data'][$_REQUEST['ls_productId']], true);
    $image_relative_path = $image_relative_path['detailed']['relative_path'];
    $thumbnail_path = fn_generate_thumbnail($image_relative_path, 150, 150, false);
    if (!empty($thumbnail_path)) {
        $fav_product_img = "<img class='ty-pict' src='{$thumbnail_path}'>";
    } else {
        $fav_product_img = "<span class='ty-no-image' style='min-width: 118px; min-height: 150px;'><i class='ty-no-image__icon ty-icon-image'></i></span>";
    }
    $wishlist =& $_SESSION['wishlist'];
    $found = array();
    //get the required id hash from session based on product_id
    foreach ($wishlist as $k0 => $v0) {
        foreach ($v0 as $k1 => $v1) {
            if (multi_array_search($_REQUEST['ls_productId'], $v1)) {
                $footerFavId2 = $k1;
                $product_options = $v1['product_options'];