コード例 #1
0
ファイル: Pdf.php プロジェクト: ambient-lounge/site
 protected function printProductRow($product, $options_variants = array())
 {
     $tbl = '<tr>';
     foreach ($this->selected_fields as $field_name => $active) {
         $tbl .= '<td width="' . $this->price_schema['fields'][$field_name]['min_width'] . '%">';
         if ($field_name == 'image') {
             if (!empty($product['main_pair']) && ($image_data = fn_image_to_display($product['main_pair'], 0, static::IMAGE_HEIGHT))) {
                 $tbl .= '<img src="' . $image_data['image_path'] . '" width= "' . $image_data['width'] . '" height="' . $image_data['height'] . '" alt="">';
             }
         } elseif ($field_name == 'product' && !empty($options_variants)) {
             $options = array();
             foreach ($options_variants as $option_id => $variant_id) {
                 $options[] = htmlspecialchars($product['product_options'][$option_id]['option_name'] . ': ' . $product['product_options'][$option_id]['variants'][$variant_id]['variant_name']);
             }
             $options = implode('<br>', $options);
             $tbl .= htmlspecialchars($product[$field_name]) . '<br>' . $options;
         } elseif ($field_name == 'price') {
             $tbl .= fn_format_price($product[$field_name], CART_PRIMARY_CURRENCY, null, false);
         } else {
             $tbl .= htmlspecialchars($product[$field_name]);
         }
         $tbl .= '</td>';
     }
     $tbl .= '</tr>';
     $this->tbl .= $tbl;
 }
コード例 #2
0
ファイル: func.php プロジェクト: ambient-lounge/site
function fn_insurance_calculate_cart(&$cart, $cart_products, $auth, $calculate_shipping, $calculate_taxes, $apply_cart_promotions)
{
    // Set default value
    // [eileen]
    //	if (!isset($cart['is_insurance'])) {
    // 		$cart['is_insurance'] = Registry::get('addons.insurance.enabled_by_default') == 'Y' ? 'Y' : 'N';
    $cart['is_insurance'] = Registry::get('addons.insurance.enabled_by_default') == 'Y' ? 'Y' : (!isset($cart['is_insurance']) ? 'N' : $cart['is_insurance']);
    //	}
    // [/eileen]
    // Set setting from checkbox
    if (isset($_GET['is_insurance'])) {
        if ($_GET['is_insurance'] == 'Y') {
            $cart['is_insurance'] = 'Y';
            fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('insurance_is_on'));
        } elseif ($_GET['is_insurance'] == 'N') {
            $cart['is_insurance'] = 'N';
            fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('insurance_is_off'));
        }
    }
    // Add insurance cost to total
    if ($cart['is_insurance'] == 'Y') {
        $cart['insurance_cost'] = fn_format_price(floatval(Registry::get('addons.insurance.price')));
        $cart['total'] = fn_format_price($cart['total'] + $cart['insurance_cost']);
    }
}
コード例 #3
0
ファイル: skrill_func.php プロジェクト: ambient-lounge/site
function fn_mb_adjust_amount($price, $payment_currency)
{
    $currencies = Registry::get('currencies');
    if (array_key_exists($payment_currency, $currencies)) {
        if ($currencies[$payment_currency]['is_primary'] != 'Y') {
            $price = fn_format_price($price / $currencies[$payment_currency]['coefficient']);
        }
    } else {
        return false;
    }
    return $price;
}
コード例 #4
0
ファイル: func.php プロジェクト: askzap/ultimate
function fn_google_anaylitics_send($account, $order_info, $refuse = false)
{
    $url = 'http://www.google-analytics.com/collect';
    $sign = $refuse == true ? '-' : '';
    //Common data which should be sent with any request
    $required_data = array('v' => '1', 'tid' => $account, 'cid' => md5($order_info['email']), 'ti' => $order_info['order_id'], 'cu' => $order_info['secondary_currency']);
    $transaction = array('t' => 'transaction', 'tr' => $sign . $order_info['total'], 'ts' => $sign . $order_info['shipping_cost'], 'tt' => $sign . $order_info['tax_subtotal']);
    $result = Http::get($url, fn_array_merge($required_data, $transaction));
    foreach ($order_info['products'] as $item) {
        $item = array('t' => 'item', 'in' => $item['product'], 'ip' => fn_format_price($item['subtotal'] / $item['amount']), 'iq' => $sign . $item['amount'], 'ic' => $item['product_code'], 'iv' => fn_ga_get_main_category($item['product_id'], $order_info['lang_code']));
        $result = Http::get($url, fn_array_merge($required_data, $item));
    }
}
コード例 #5
0
function fn_exim_google_export_format_price($product_price, $product_id = 0)
{
    static $auth;
    if (empty($auth)) {
        $auth = fn_fill_auth();
    }
    $product = fn_get_product_data($product_id, $auth, CART_LANGUAGE, false, false, false, false, false, false, false);
    fn_promotion_apply('catalog', $product, $auth);
    $_discount = 0;
    if (!empty($product['discount'])) {
        $_discount = $product['discount'];
    }
    return fn_format_price($product_price - $_discount, CART_PRIMARY_CURRENCY, null, false);
}
コード例 #6
0
ファイル: realex_remote.php プロジェクト: ambient-lounge/site
 protected function getRequestData()
 {
     $currency_settings = Registry::get('currencies.' . $this->processor_data['processor_params']['currency']);
     if (empty($currency_settings)) {
         $currency_settings = Registry::get('currencies.' . CART_PRIMARY_CURRENCY);
     }
     $timestamp = empty($_REQUEST['timestamp']) ? date('Ymdhis') : $_REQUEST['timestamp'];
     $billing_zipcode = preg_replace("/[^0-9]/", '', $this->order_info['b_zipcode']);
     $billing_address = preg_replace("/[^0-9]/", '', $this->order_info['b_address']);
     $shipping_zipcode = preg_replace("/[^0-9]/", '', $this->order_info['s_zipcode']);
     $shipping_address = preg_replace("/[^0-9]/", '', $this->order_info['s_address']);
     $request_data = array('ORDER_ID' => $this->order_info['order_id'] . $timestamp, 'MERCHANT_ID' => $this->processor_data['processor_params']['merchant_id'], 'ACCOUNT' => $this->processor_data['processor_params']['account'], 'AUTO_SETTLE_FLAG' => (int) ($this->processor_data['processor_params']['settlement'] == 'auto'), 'CURRENCY' => $currency_settings['currency_code'], 'AMOUNT' => fn_format_price($this->order_info['total'] / $currency_settings['coefficient'], $currency_settings['currency_code']) * 100, 'SHIPPING_CO' => $this->order_info['s_country'], 'BILLING_CO' => $this->order_info['b_country'], 'SHIPPING_CODE' => substr($shipping_zipcode, 0, 5) . '|' . substr($shipping_address, 0, 5), 'BILLING_CODE' => substr($billing_zipcode, 0, 5) . '|' . substr($billing_address, 0, 5), 'TIMESTAMP' => $timestamp);
     $request_data['SHA1HASH'] = sha1(strtolower(sha1($request_data['TIMESTAMP'] . '.' . $request_data['MERCHANT_ID'] . '.' . $request_data['ORDER_ID'] . '.' . $request_data['AMOUNT'] . '.' . $request_data['CURRENCY'] . '.' . $this->order_info['payment_info']['card_number'])) . '.' . $this->processor_data['processor_params']['secret_word']);
     return $request_data;
 }
コード例 #7
0
ファイル: func.php プロジェクト: diedsmiling/busenika
function fn_google_anaylitics_send($account, $order_info, $refuse = false)
{
    $_uwv = '1';
    $url = "http://www.google-analytics.com/__utm.gif";
    $sign = $refuse == true ? '-' : '';
    $cookies = fn_google_analytics_cookies();
    // Transaction request
    // http://www.google-analytics.com/__utm.gif?utmwv=1&utmt=tran&utmn=262780020&utmtid=80&utmtto=3.96&utmttx=0&utmtsp=0.00&utmtci=Boston&utmtrg=MA&utmtco=United%20States&utmac=ASSASAS&utmcc=__utma%3D81851599.2062069588.1182951649.1183008786.1183012376.3%3B%2B__utmb%3D81851599%3B%2B__utmc%3D81851599%3B%2B__utmz%3D81851599.1182951649.1.1.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)%3B%2B
    $transaction = array('utmwv' => $_uwv, 'utmt' => 'tran', 'utmn' => rand(0, 2147483647), 'utmtid' => $order_info['order_id'], 'utmtto' => $sign . $order_info['total'], 'utmttx' => $order_info['tax_subtotal'], 'utmtsp' => $order_info['shipping_cost'], 'utmtci' => $order_info['b_city'], 'utmtrg' => $order_info['b_state'], 'utmtco' => $order_info['b_country_descr'], 'utmac' => $account, 'utmcc' => $cookies);
    list(, $result) = fn_http_request('GET', $url, $transaction);
    // Items request
    //http://www.google-analytics.com/__utm.gif?utmwv=1&utmt=item&utmn=812678190&utmtid=80&utmipc=B00078MG5M&utmipn=100%25%20Cotton%20Adult%2FYouth%20Beefy%20T-Shirt%20by%20Hanes%20(Style%23%205180)&utmipr=4.50&utmiqt=1&utmac=ASSASAS&utmcc=
    foreach ($order_info['items'] as $item) {
        $cat_id = db_get_field("SELECT category_id FROM ?:products_categories WHERE product_id = ?i AND link_type = 'M'", $item['product_id']);
        $i = array('utmwv' => $_uwv, 'utmt' => 'item', 'utmn' => rand(0, 2147483647), 'utmtid' => $order_info['order_id'], 'utmipc' => $item['product_code'], 'utmipn' => $item['product'], 'utmiva' => fn_get_category_name($cat_id, $order_info['lang_code']), 'utmipr' => $sign . fn_format_price($item['subtotal'] / $item['amount']), 'utmiqt' => $item['amount'], 'utmac' => $account, 'utmcc' => $cookies);
        list(, $result) = fn_http_request('GET', $url, $i);
    }
}
コード例 #8
0
ファイル: eway_shared.php プロジェクト: askzap/ultimate
    }
    fn_finish_payment($_REQUEST['order_id'], $pp_response);
    fn_order_placement_routines('route', $_REQUEST['order_id']);
    exit;
} else {
    $order_prefix = !empty($processor_data['processor_params']['order_prefix']) ? $processor_data['processor_params']['order_prefix'] : '';
    $return_url = fn_url("payment_notification.notify?payment=eway_shared&order_id={$order_id}", AREA, 'current');
    $MerchantInvoice = $order_prefix . ($order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id);
    if ($processor_data['processor_params']['gateway'] == 'payment') {
        $currency = 'GBP';
    } elseif ($processor_data['processor_params']['gateway'] == 'nz') {
        $currency = 'NZD';
    } else {
        $currency = 'AUD';
    }
    $request_url = 'https://' . $processor_data['processor_params']['gateway'] . '.ewaygateway.com/Request/?' . 'CustomerID=' . $processor_data['processor_params']['customer_id'] . '&UserName='******'processor_params']['username'] . '&Amount=' . fn_format_price($order_info['total'], $currency, 2, false) . '&Currency=' . $currency . '&ReturnURL=' . urlencode($return_url) . '&CancelURL=' . urlencode($return_url) . '&InvoiceDescription=' . (!empty($order_info['notice']) ? $order_info['notice'] : '') . '&CompanyName=' . urlencode(Registry::get('settings.Company.company_name')) . '&CustomerFirstName=' . urlencode($order_info['b_firstname']) . '&CustomerLastName=' . urlencode($order_info['b_lastname']) . '&CustomerAddress=' . urlencode($order_info['b_address']) . '&CustomerCity=' . urlencode($order_info['b_city']) . '&CustomerState=' . urlencode($order_info['b_state_descr']) . '&CustomerPostCode=' . urlencode($order_info['b_zipcode']) . '&CustomerCountry=' . urlencode($order_info['b_country_descr']) . '&CustomerPhone=' . urlencode($order_info['phone']) . '&CustomerEmail=' . urlencode($order_info['email']) . '&MerchantReference=' . urlencode($MerchantInvoice);
    $return = Http::get($request_url);
    $sucessfull = 'False';
    if (preg_match("/<Result>(.*)<\\/Result>/", $return, $matches)) {
        $sucessfull = $matches[1];
    }
    if ($sucessfull == 'True') {
        if (preg_match("/<URI>(.*)<\\/URI>/", $return, $matches)) {
            fn_create_payment_form($matches[1], array(), '', true, 'get');
        }
    } else {
        if (preg_match("/<Error>(.*)<\\/Error>/", $return, $matches)) {
            $pp_response['reason_text'] = $matches[1];
        }
        $pp_response['order_status'] = 'D';
    }
コード例 #9
0
ファイル: func.php プロジェクト: diedsmiling/busenika
function fn_buy_together_calculate_discount($price, $modifier = 0, $modifier_type = 'to_fixed')
{
    $discount = 0;
    switch ($modifier_type) {
        case 'to_fixed':
            $discount = $price - $modifier;
            break;
        case 'by_fixed':
            $discount = $modifier;
            break;
        case 'to_percentage':
            $discount = $price - $price / 100 * $modifier;
            break;
        case 'by_percentage':
            $discount = $price / 100 * $modifier;
            break;
    }
    if ($discount > $price) {
        $discount = $price;
    }
    $discount = fn_format_price($discount);
    $discounted_price = $price - $discount;
    return array($discount, $discounted_price);
}
コード例 #10
0
ファイル: func.php プロジェクト: heg-arc-ne/cscart
function fn_rma_recalculate_order($order_id, $recalculate_type, $return_id, $is_refund, $ex_data)
{
    if (empty($recalculate_type) || empty($return_id) || empty($order_id) || !is_array($ex_data) || $recalculate_type == 'M' && !isset($ex_data['total'])) {
        return false;
    }
    $order = db_get_row("SELECT total, subtotal, discount, shipping_cost, status FROM ?:orders WHERE order_id = ?i", $order_id);
    $order_items = db_get_hash_array("SELECT * FROM ?:order_details WHERE ?:order_details.order_id = ?i", 'item_id', $order_id);
    $additional_data = db_get_hash_single_array("SELECT type, data FROM ?:order_data WHERE order_id = ?i", array('type', 'data'), $order_id);
    $order_return_info = @unserialize(@$additional_data[ORDER_DATA_RETURN]);
    $order_tax_info = @unserialize(@$additional_data['T']);
    $status_order = $order['status'];
    unset($order['status']);
    if ($recalculate_type == 'R') {
        $product_groups = @unserialize(@$additional_data['G']);
        if ($is_refund == 'Y') {
            $sign = $ex_data['inventory_to'] == 'I' ? -1 : 1;
            // What for is this section ???
            if (!empty($order_return_info['returned_products'])) {
                foreach ($order_return_info['returned_products'] as $item_id => $item) {
                    if (isset($item['extra']['returns'][$return_id])) {
                        $r_item = $o_item = $item;
                        unset($r_item['extra']['returns'][$return_id]);
                        $r_item['amount'] = $item['amount'] - $item['extra']['returns'][$return_id]['amount'];
                        fn_rma_recalculate_order_routine($order, $r_item, $item, 'O-', $ex_data);
                        if (empty($r_item['amount'])) {
                            unset($order_return_info['returned_products'][$item_id]);
                        } else {
                            $order_return_info['returned_products'][$item_id] = $r_item;
                        }
                        $o_item['primordial_amount'] = (isset($order_items[$item_id]) ? $order_items[$item_id]['amount'] : 0) + $item['extra']['returns'][$return_id]['amount'];
                        $o_item['primordial_discount'] = @$o_item['extra']['discount'];
                        fn_rma_recalculate_order_routine($order, $o_item, $item, 'M+', $ex_data);
                        $o_item['amount'] = (isset($order_items[$item_id]) ? $order_items[$item_id]['amount'] : 0) + $item['extra']['returns'][$return_id]['amount'];
                        if (isset($order_items[$item_id]['extra'])) {
                            $o_item['extra'] = @unserialize($order_items[$item_id]['extra']);
                        }
                        $o_item['extra']['returns'][$return_id] = $item['extra']['returns'][$return_id];
                        $o_item['extra'] = serialize($o_item['extra']);
                        if (!isset($order_items[$item_id])) {
                            db_query("REPLACE INTO ?:order_details ?e", $o_item);
                        } else {
                            db_query("UPDATE ?:order_details SET ?u WHERE item_id = ?i AND order_id = ?i", $o_item, $item_id, $order_id);
                        }
                    }
                }
            }
            // Check all the products and update their amount and cost.
            foreach ($order_items as $item_id => $item) {
                $item['extra'] = @unserialize($item['extra']);
                if (isset($item['extra']['returns'][$return_id])) {
                    $o_item = $item;
                    $o_item['amount'] = $o_item['amount'] + $sign * $item['extra']['returns'][$return_id]['amount'];
                    unset($o_item['extra']['returns'][$return_id]);
                    if (empty($o_item['extra']['returns'])) {
                        unset($o_item['extra']['returns']);
                    }
                    fn_rma_recalculate_order_routine($order, $o_item, $item, '', $ex_data);
                    if (empty($o_item['amount'])) {
                        db_query("DELETE FROM ?:order_details WHERE item_id = ?i AND order_id = ?i", $item_id, $order_id);
                    } else {
                        $o_item['extra'] = serialize($o_item['extra']);
                        db_query("UPDATE ?:order_details SET ?u WHERE item_id = ?i AND order_id = ?i", $o_item, $item_id, $order_id);
                    }
                    if (!isset($order_return_info['returned_products'][$item_id])) {
                        $r_item = $item;
                        unset($r_item['extra']['returns']);
                        $r_item['amount'] = $item['extra']['returns'][$return_id]['amount'];
                    } else {
                        $r_item = $order_return_info['returned_products'][$item_id];
                        $r_item['amount'] = $r_item['amount'] + $item['extra']['returns'][$return_id]['amount'];
                    }
                    fn_rma_recalculate_order_routine($order, $r_item, $item, 'M-O+', $ex_data);
                    $r_item['extra']['returns'][$return_id] = $item['extra']['returns'][$return_id];
                    $order_return_info['returned_products'][$item_id] = $r_item;
                    fn_rma_update_order_taxes($order_tax_info, $item_id, $item['amount'], $o_item['amount'], $order);
                }
            }
            $_ori_data = array('order_id' => $order_id, 'type' => ORDER_DATA_RETURN, 'data' => $order_return_info);
        }
        $shipping_info = array();
        if ($product_groups) {
            $_total = 0;
            foreach ($product_groups as $key_group => $group) {
                if (isset($group['chosen_shippings'])) {
                    foreach ($group['chosen_shippings'] as $key_shipping => $shipping) {
                        $_total += $shipping['rate'];
                    }
                }
            }
            foreach ($product_groups as $key_group => $group) {
                if (isset($group['chosen_shippings'])) {
                    foreach ((array) $ex_data['shipping_costs'] as $shipping_id => $cost) {
                        foreach ($group['chosen_shippings'] as $key_shipping => $shipping) {
                            $shipping_id = $shipping['shipping_id'];
                            $product_groups[$key_group]['chosen_shippings'][$key_shipping]['rate'] = fn_format_price($_total ? $shipping['rate'] / $_total * $cost : $cost / count($product_groups));
                            $product_groups[$key_group]['shippings'][$shipping_id]['rate'] = fn_format_price($_total ? $shipping['rate'] / $_total * $cost : $cost / count($product_groups));
                            if (empty($shipping_info[$shipping_id])) {
                                $shipping_info[$shipping_id] = $product_groups[$key_group]['shippings'][$shipping_id];
                            }
                            $shipping_info[$shipping_id]['rates'][$key_group] = $product_groups[$key_group]['shippings'][$shipping_id]['rate'];
                        }
                    }
                }
            }
            db_query("UPDATE ?:order_data SET ?u WHERE order_id = ?i AND type = 'G'", array('data' => serialize($product_groups)), $order_id);
            fn_update_shipping_taxes($order_tax_info, $shipping_info, $order);
        }
        $order['total'] -= $order['shipping_cost'];
        $order['shipping_cost'] = isset($ex_data['shipping_costs']) ? array_sum($ex_data['shipping_costs']) : $order['shipping_cost'];
        $order['total'] += $order['shipping_cost'];
        $order['total'] = $order['total'] < 0 ? 0 : $order['total'];
        if (!empty($order_tax_info)) {
            db_query("UPDATE ?:order_data SET ?u WHERE order_id = ?i AND type = 'T'", array('data' => serialize($order_tax_info)), $order_id);
        }
    } elseif ($recalculate_type == 'M') {
        $order['total'] = $order['total'] + $ex_data['total'];
        $_ori_data = array('order_id' => $order_id, 'type' => ORDER_DATA_RETURN, 'data' => array('return' => fn_format_price((isset($order_return_info['return']) ? $order_return_info['return'] : 0) - $ex_data['total']), 'returned_products' => isset($order_return_info['returned_products']) ? $order_return_info['returned_products'] : ''));
        $return_products = db_get_hash_array("SELECT * FROM ?:rma_return_products WHERE return_id = ?i AND type = ?s", 'item_id', $return_id, RETURN_PRODUCT_ACCEPTED);
        foreach ((array) $return_products as $item_id => $v) {
            $v['extra']['product_options'] = @unserialize($v['extra']['product_options']);
            if ($ex_data['inventory_to'] == 'D' || $ex_data['status_to'] == RMA_DEFAULT_STATUS) {
                fn_update_product_amount($v['product_id'], $v['amount'], @$v['extra']['product_options'], '-');
            } elseif ($ex_data['inventory_to'] == 'I') {
                fn_update_product_amount($v['product_id'], $v['amount'], $v['extra']['product_options'], '+');
            }
        }
    }
    if ($is_refund == 'Y') {
        if (isset($_ori_data['data']['return']) && floatval($_ori_data['data']['return']) == 0) {
            unset($_ori_data['data']['return']);
        }
        if (empty($_ori_data['data']['returned_products'])) {
            unset($_ori_data['data']['returned_products']);
        }
        if (!empty($_ori_data['data'])) {
            $_ori_data['data'] = serialize($_ori_data['data']);
            db_query("REPLACE INTO ?:order_data ?e", $_ori_data);
        } else {
            db_query("DELETE FROM ?:order_data WHERE order_id = ?i AND type = ?s", $order_id, ORDER_DATA_RETURN);
        }
    }
    foreach ($order as $k => $v) {
        $order[$k] = fn_format_price($v);
    }
    db_query("UPDATE ?:orders SET ?u WHERE order_id = ?i", $order, $order_id);
    if (fn_allowed_for('MULTIVENDOR')) {
        $_SESSION['cart'] = isset($_SESSION['cart']) ? $_SESSION['cart'] : array();
        $cart =& $_SESSION['cart'];
        $action = 'save';
        fn_mve_place_order($order_id, $action, $status_order, $cart);
    }
}
コード例 #11
0
ファイル: Yml.php プロジェクト: askzap/ask-zap
 protected function offer($product)
 {
     $yml_data = array();
     $offer_attrs = '';
     $market_categories = $this->getMarketCategories();
     if (!empty($product['yml_bid'])) {
         $offer_attrs .= '@bid=' . $product['yml_bid'];
     }
     if (!empty($product['yml_cbid'])) {
         $offer_attrs .= '@cbid=' . $product['yml_cbid'];
     }
     $price_fields = array('price', 'yml_cost', 'list_price', 'base_price');
     $currency_data = Registry::get('currencies.' . CART_PRIMARY_CURRENCY);
     foreach ($price_fields as $field) {
         $product[$field] = fn_format_price($product[$field], $currency_data['currency_code'], $currency_data['decimals'], false);
     }
     if (CART_PRIMARY_CURRENCY != "RUB" && CART_PRIMARY_CURRENCY != "UAH" && CART_PRIMARY_CURRENCY != "BYR" && CART_PRIMARY_CURRENCY != "KZT") {
         $currencies = Registry::get('currencies');
         if (isset($currencies['RUB'])) {
             $currency = $currencies['RUB'];
         } elseif (isset($currencies['UAH'])) {
             $currency = $currencies['UAH'];
         } elseif (isset($currencies['BYR'])) {
             $currency = $currencies['BYR'];
         } elseif (isset($currencies['KZT'])) {
             $currency = $currencies['KZT'];
         }
         if (!empty($currency)) {
             foreach ($price_fields as $field) {
                 $product[$field] = fn_format_rate_value($product[$field], 'F', $currency['decimals'], '.', '', $currency['coefficient']);
             }
         }
     }
     foreach ($price_fields as $field) {
         if (empty($product[$field])) {
             $product[$field] = floatval($product[$field]) ? $product[$field] : fn_parse_price($product[$field]);
         }
     }
     $yml_data['url'] = $product['product_url'];
     $yml_data['price'] = !empty($product['price']) ? $product['price'] : "0.00";
     if (!empty($product['base_price']) && $product['price'] < $product['base_price'] * 0.95) {
         $yml_data['oldprice'] = $product['base_price'];
     } elseif (!empty($product['list_price']) && $product['price'] < $product['list_price'] * 0.95) {
         $yml_data['oldprice'] = $product['list_price'];
     }
     $yml_data['currencyId'] = !empty($currency) ? $currency['currency_code'] : CART_PRIMARY_CURRENCY;
     $yml_data['categoryId'] = $product['category_id'];
     if ($this->options['market_category'] == "Y") {
         if ($this->options['market_category_object'] == "category" && isset($market_categories[$product['category_id']])) {
             $yml_data['market_category'] = $market_categories[$product['category_id']];
         } elseif ($this->options['market_category_object'] == "product" && !empty($product['yml_market_category'])) {
             $yml_data['market_category'] = $product['yml_market_category'];
         }
     }
     // Images
     $picture_index = 0;
     while ($image = array_shift($product['images'])) {
         $key = 'picture';
         if ($picture_index) {
             $key .= '+' . $picture_index;
         }
         $yml_data[$key] = $this->getImageUrl($image);
         $picture_index++;
     }
     $yml_data['store'] = $product['yml_store'] == 'Y' ? 'true' : 'false';
     $yml_data['pickup'] = $product['yml_pickup'] == 'Y' ? 'true' : 'false';
     $yml_data['delivery'] = $product['yml_delivery'] == 'Y' ? 'true' : 'false';
     if ($product['yml_adult'] == 'Y') {
         $yml_data['adult'] = 'true';
     }
     if ($this->options['local_delivery_cost'] == "Y") {
         $yml_data['local_delivery_cost'] = $product['yml_cost'] == 0 ? '0' : $product['yml_cost'];
     }
     $type = '';
     if ($this->options['export_type'] == 'vendor_model') {
         $type = '@type=vendor.model';
         if ($this->options['type_prefix'] == "Y") {
             if (!empty($product['yml_type_prefix'])) {
                 $yml_data['typePrefix'] = $product['yml_type_prefix'];
             } else {
                 $yml_data['typePrefix'] = $product['category'];
             }
         }
         $yml_data['vendor'] = $product['brand'];
         if ($this->options['export_vendor_code'] == 'Y') {
             $vendor_code = $this->getVendorCode($product);
             if (!empty($vendor_code)) {
                 $yml_data['vendorCode'] = $vendor_code;
             }
         }
         $yml_data['model'] = !empty($product['yml_model']) ? $product['yml_model'] : '';
     } elseif ($this->options['export_type'] == 'simple') {
         $yml_data['name'] = $product['product'];
         if (!empty($product['brand'])) {
             $yml_data['vendor'] = $product['brand'];
         }
         if ($this->options['export_vendor_code'] == 'Y') {
             $vendor_code = $this->getVendorCode($product);
             if (!empty($vendor_code)) {
                 $yml_data['vendorCode'] = $vendor_code;
             }
         }
     }
     if (!empty($product['full_description'])) {
         //Stripping the invalid chars
         $product['full_description'] = preg_replace('/[^\\x{0009}\\x{000A}\\x{000D}\\x{0020}-\\x{D7FF}\\x{E000}-\\x{FFFD}\\x{10000}-\\x{10FFFF}]/u', '', $product['full_description']);
         $yml_data['description'] = $product['full_description'];
     }
     if (!empty($product['yml_sales_notes'])) {
         $yml_data['sales_notes'] = $product['yml_sales_notes'];
     }
     if (!empty($product['yml_manufacturer_warranty'])) {
         $yml_data['manufacturer_warranty'] = $product['yml_manufacturer_warranty'];
     }
     if (!empty($product['yml_seller_warranty'])) {
         $yml_data['seller_warranty'] = $product['yml_seller_warranty'];
     }
     if (!empty($product['yml_origin_country']) && fn_yandex_market_check_country($product['yml_origin_country'])) {
         $yml_data['country_of_origin'] = $product['yml_origin_country'];
     }
     if (!empty($product['product_features'])) {
         foreach ($product['product_features'] as $feature) {
             $yml_data['param@name=' . $this->escape($feature['description'])] = $feature['value'];
         }
     }
     if ($product['amount'] > 0) {
         $avail = 'true';
     } else {
         $avail = 'false';
     }
     return array('offer@id=' . $product['product_id'] . $type . '@available=' . $avail . $offer_attrs, $yml_data);
 }
コード例 #12
0
ファイル: Ebay.php プロジェクト: ambient-lounge/site
    private function _getBaseItemData($product, $template, $images_data)
    {
        $currency = CART_PRIMARY_CURRENCY;
        $shippings = $this->prepareShipping($product, $template);
        $company = fn_get_company_placement_info(Registry::get('runtime.company_id'));
        $price = fn_format_price($product['price']);
        $picture_details = '';
        if ($product['override'] == "Y") {
            $title = substr(strip_tags($product['ebay_title']), 0, 80);
            $description = !empty($product['ebay_description']) ? $product['ebay_description'] : $product['full_description'];
        } else {
            $title = substr(strip_tags($product['product']), 0, 80);
            $description = $product['full_description'];
        }
        $payments = '<PaymentMethods>' . implode("</PaymentMethods>\n<PaymentMethods>", $template['payment_methods']) . '</PaymentMethods>';
        if (in_array('PayPal', $template['payment_methods'])) {
            $payments .= "\n<PayPalEmailAddress>{$template['paypal_email']}</PayPalEmailAddress>";
        }
        if (!empty($product['main_pair']) && !empty($product['main_pair']['detailed']) && !empty($product['main_pair']['detailed']['http_image_path']) && $images_data[md5($product['main_pair']['detailed']['http_image_path'])]) {
            $image_url = $images_data[md5($product['main_pair']['detailed']['http_image_path'])];
            $picture_details .= "<PictureURL>{$image_url}</PictureURL>\n";
        }
        if ($product['image_pairs']) {
            foreach ($product['image_pairs'] as $image_pair) {
                if (!empty($images_data[md5($image_pair['detailed']['http_image_path'])])) {
                    $image_url = $images_data[md5($image_pair['detailed']['http_image_path'])];
                    $picture_details .= "<PictureURL>{$image_url}</PictureURL>\n";
                }
            }
        }
        $picture_details = empty($picture_details) ? '' : "<PictureDetails>\n{$picture_details}</PictureDetails>";
        $product_features = '';
        if (!empty($product['product_features'])) {
            $product_features = '<ItemSpecifics>' . fn_prepare_xml_product_features($product['product_features']) . '</ItemSpecifics>';
        }
        $product_options = '';
        $start_price = '';
        $product_quantity = '';
        $inventory_combinations = db_get_array("SELECT combination FROM ?:product_options_inventory WHERE product_id = ?i AND amount > 0 AND combination != ''", $product['product_id']);
        if (!empty($product['product_options']) && !empty($inventory_combinations)) {
            $params = array('page' => 1, 'product_id' => $product['product_id']);
            $product_options = '<Variations>' . fn_prepare_xml_product_options($params, $product, $images_data) . '</Variations>';
        }
        if (empty($product_options)) {
            $start_price = '<StartPrice currencyID="' . $currency . '">' . $price . '</StartPrice>';
            $product_quantity = '<Quantity>' . $product['amount'] . '</Quantity>';
        }
        $location = fn_get_country_name($company['company_country']);
        $xml = <<<EOT
<ItemID>{$product['ebay_item_id']}</ItemID>
<Site>{$template['site']}</Site>
<ListingType>FixedPriceItem</ListingType>
<Currency>{$currency}</Currency>
<PrimaryCategory>
<CategoryID>{$template['category']}</CategoryID>
</PrimaryCategory>
<SecondaryCategory>
<CategoryID>{$template['sec_category']}</CategoryID>
</SecondaryCategory>
<ConditionID>{$template['condition_id']}</ConditionID>
<CategoryMappingAllowed>true</CategoryMappingAllowed>
<Country>{$company['company_country']}</Country>
<PostalCode>{$company['company_zipcode']}</PostalCode>
<Location>{$location}</Location>
<Title><![CDATA[{$title}]]></Title>
<Description><![CDATA[{$description}]]></Description>
{$payments}
<ListingDuration>{$template['ebay_duration']}</ListingDuration>
<DispatchTimeMax>{$template['dispatch_days']}</DispatchTimeMax>
{$shippings}
{$picture_details}
{$product_features}
{$product_options}
{$start_price}
{$product_quantity}
EOT;
        return $xml;
    }
    function content_55db8f57a02b71_27074353($_smarty_tpl)
    {
        if (!is_callable('smarty_block_hook')) {
            include '/var/www/html/market/app/functions/smarty_plugins/block.hook.php';
        }
        if (!is_callable('smarty_modifier_truncate')) {
            include '/var/www/html/market/app/functions/smarty_plugins/modifier.truncate.php';
        }
        if (!is_callable('smarty_modifier_enum')) {
            include '/var/www/html/market/app/functions/smarty_plugins/modifier.enum.php';
        }
        fn_preload_lang_vars(array('position_short', 'image', 'name', 'sku', 'price', 'list_price', 'purchased_qty', 'subtotal_sum', 'quantity', 'status', 'sku', 'edit', 'edit', 'delete', 'no_data', 'text_select_fields2edit_note', 'modify_selected', 'global_update', 'bulk_product_addition', 'product_subscriptions', 'edit_selected', 'clone_selected', 'export_selected', 'add_product', 'select_fields_to_edit', 'products'));
        $_smarty_tpl->_capture_stack[0][] = array("mainbox", null, null);
        ob_start();
        ?>

<form action="<?php 
        echo htmlspecialchars(fn_url(''), ENT_QUOTES, 'UTF-8');
        ?>
" method="post" name="manage_products_form" id="manage_products_form">
<input type="hidden" name="category_id" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['search']->value['cid'], ENT_QUOTES, 'UTF-8');
        ?>
" />

<?php 
        echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('save_current_page' => true, 'save_current_url' => true, 'div_id' => $_REQUEST['content_id']), 0);
        ?>


<?php 
        $_smarty_tpl->tpl_vars["c_url"] = new Smarty_variable(fn_query_remove($_smarty_tpl->tpl_vars['config']->value['current_url'], "sort_by", "sort_order"), null, 0);
        ?>

<?php 
        $_smarty_tpl->tpl_vars["rev"] = new Smarty_variable(($tmp = @$_REQUEST['content_id']) === null || $tmp === '' ? "pagination_contents" : $tmp, null, 0);
        $_smarty_tpl->tpl_vars["c_icon"] = new Smarty_variable("<i class=\"exicon-" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev'] . "\"></i>", null, 0);
        $_smarty_tpl->tpl_vars["c_dummy"] = new Smarty_variable("<i class=\"exicon-dummy\"></i>", null, 0);
        ?>

<?php 
        if ($_smarty_tpl->tpl_vars['products']->value) {
            ?>
<table width="100%" class="table table-middle">
<thead>
<tr>
    <th class="left">
        <?php 
            echo $_smarty_tpl->getSubTemplate("common/check_items.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('check_statuses' => fn_get_default_status_filters('', true)), 0);
            ?>

    </th>
    <?php 
            if ($_smarty_tpl->tpl_vars['search']->value['cid'] && $_smarty_tpl->tpl_vars['search']->value['subcats'] != "Y") {
                ?>
    <th class="nowrap"><a class="cm-ajax" href="<?php 
                echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=position&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
                ?>
" data-ca-target-id=<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
                ?>
><?php 
                echo $_smarty_tpl->__("position_short");
                if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "position") {
                    echo $_smarty_tpl->tpl_vars['c_icon']->value;
                } else {
                    echo $_smarty_tpl->tpl_vars['c_dummy']->value;
                }
                ?>
</a></th>
    <?php 
            }
            ?>
    <th width="5%"><span><?php 
            echo $_smarty_tpl->__("image");
            ?>
</span></th>
    <th width="45%"><a class="cm-ajax" href="<?php 
            echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=product&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
            ?>
" data-ca-target-id=<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
            ?>
><?php 
            echo $_smarty_tpl->__("name");
            if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "product") {
                echo $_smarty_tpl->tpl_vars['c_icon']->value;
            } else {
                echo $_smarty_tpl->tpl_vars['c_dummy']->value;
            }
            ?>
</a> /&nbsp;&nbsp;&nbsp; <a class="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['ajax_class']->value, ENT_QUOTES, 'UTF-8');
            ?>
" href="<?php 
            echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=code&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
            ?>
" data-ca-target-id=<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
            ?>
><?php 
            echo $_smarty_tpl->__("sku");
            if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "code") {
                echo $_smarty_tpl->tpl_vars['c_icon']->value;
            } else {
                echo $_smarty_tpl->tpl_vars['c_dummy']->value;
            }
            ?>
</a></th>
    <th width="15%"><a class="cm-ajax" href="<?php 
            echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=price&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
            ?>
" data-ca-target-id=<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
            ?>
><?php 
            echo $_smarty_tpl->__("price");
            ?>
 (<?php 
            echo $_smarty_tpl->tpl_vars['currencies']->value[$_smarty_tpl->tpl_vars['primary_currency']->value]['symbol'];
            ?>
)<?php 
            if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "price") {
                echo $_smarty_tpl->tpl_vars['c_icon']->value;
            } else {
                echo $_smarty_tpl->tpl_vars['c_dummy']->value;
            }
            ?>
</a></th>
    <th width="15%"><a class="cm-ajax" href="<?php 
            echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=list_price&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
            ?>
" data-ca-target-id=<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
            ?>
><?php 
            echo $_smarty_tpl->__("list_price");
            ?>
 (<?php 
            echo $_smarty_tpl->tpl_vars['currencies']->value[$_smarty_tpl->tpl_vars['primary_currency']->value]['symbol'];
            ?>
)<?php 
            if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "list_price") {
                echo $_smarty_tpl->tpl_vars['c_icon']->value;
            } else {
                echo $_smarty_tpl->tpl_vars['c_dummy']->value;
            }
            ?>
</a></th>
    <?php 
            if ($_smarty_tpl->tpl_vars['search']->value['order_ids']) {
                ?>
    <th width="5%"><a class="cm-ajax" href="<?php 
                echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=p_qty&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
                ?>
" data-ca-target-id=<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
                ?>
><?php 
                echo $_smarty_tpl->__("purchased_qty");
                if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "p_qty") {
                    echo $_smarty_tpl->tpl_vars['c_icon']->value;
                } else {
                    echo $_smarty_tpl->tpl_vars['c_dummy']->value;
                }
                ?>
</a></th>
    <th width="5%"><a class="cm-ajax" href="<?php 
                echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=p_subtotal&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
                ?>
" data-ca-target-id=<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
                ?>
><?php 
                echo $_smarty_tpl->__("subtotal_sum");
                ?>
 (<?php 
                echo $_smarty_tpl->tpl_vars['currencies']->value[$_smarty_tpl->tpl_vars['primary_currency']->value]['symbol'];
                ?>
)<?php 
                if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "p_subtotal") {
                    echo $_smarty_tpl->tpl_vars['c_icon']->value;
                } else {
                    echo $_smarty_tpl->tpl_vars['c_dummy']->value;
                }
                ?>
</a></th>
    <?php 
            }
            ?>
    <th width="5%" class="nowrap"><a class="cm-ajax" href="<?php 
            echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=amount&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
            ?>
" data-ca-target-id=<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
            ?>
><?php 
            echo $_smarty_tpl->__("quantity");
            if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "amount") {
                echo $_smarty_tpl->tpl_vars['c_icon']->value;
            } else {
                echo $_smarty_tpl->tpl_vars['c_dummy']->value;
            }
            ?>
</a></th>
    <th><?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:manage_head"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "products:manage_head"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "products:manage_head"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>
</th>
    <th width="5%">&nbsp;</th>
    <th width="10%" class="right"><a class="cm-ajax" href="<?php 
            echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['c_url']->value . "&sort_by=status&sort_order=" . (string) $_smarty_tpl->tpl_vars['search']->value['sort_order_rev']), ENT_QUOTES, 'UTF-8');
            ?>
" data-ca-target-id=<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['rev']->value, ENT_QUOTES, 'UTF-8');
            ?>
><?php 
            echo $_smarty_tpl->__("status");
            if ($_smarty_tpl->tpl_vars['search']->value['sort_by'] == "status") {
                echo $_smarty_tpl->tpl_vars['c_icon']->value;
            } else {
                echo $_smarty_tpl->tpl_vars['c_dummy']->value;
            }
            ?>
</a></th>
</tr>
</thead>
<?php 
            $_smarty_tpl->tpl_vars['product'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['product']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['products']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['product']->key => $_smarty_tpl->tpl_vars['product']->value) {
                $_smarty_tpl->tpl_vars['product']->_loop = true;
                ?>

<?php 
                if (fn_allowed_for("ULTIMATE")) {
                    ?>
    <?php 
                    if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && $_smarty_tpl->tpl_vars['product']->value['is_shared_product'] == "Y" && $_smarty_tpl->tpl_vars['product']->value['company_id'] != $_smarty_tpl->tpl_vars['runtime']->value['company_id']) {
                        ?>
        <?php 
                        $_smarty_tpl->tpl_vars["hide_inputs_if_shared_product"] = new Smarty_variable("cm-hide-inputs", null, 0);
                        ?>
        <?php 
                        $_smarty_tpl->tpl_vars["no_hide_input_if_shared_product"] = new Smarty_variable("cm-no-hide-input", null, 0);
                        ?>
    <?php 
                    } else {
                        ?>
        <?php 
                        $_smarty_tpl->tpl_vars["hide_inputs_if_shared_product"] = new Smarty_variable('', null, 0);
                        ?>
        <?php 
                        $_smarty_tpl->tpl_vars["no_hide_input_if_shared_product"] = new Smarty_variable('', null, 0);
                        ?>
    <?php 
                    }
                    ?>
    <?php 
                    if (!$_smarty_tpl->tpl_vars['runtime']->value['company_id'] && $_smarty_tpl->tpl_vars['product']->value['is_shared_product'] == "Y") {
                        ?>
        <?php 
                        $_smarty_tpl->tpl_vars["show_update_for_all"] = new Smarty_variable(true, null, 0);
                        ?>
    <?php 
                    } else {
                        ?>
        <?php 
                        $_smarty_tpl->tpl_vars["show_update_for_all"] = new Smarty_variable(false, null, 0);
                        ?>
    <?php 
                    }
                }
                ?>

<tr class="cm-row-status-<?php 
                echo htmlspecialchars(mb_strtolower($_smarty_tpl->tpl_vars['product']->value['status'], 'UTF-8'), ENT_QUOTES, 'UTF-8');
                ?>
 <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['hide_inputs_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
                ?>
">
    <td class="left">
    <input type="checkbox" name="product_ids[]" value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8');
                ?>
" class="checkbox cm-item cm-item-status-<?php 
                echo htmlspecialchars(mb_strtolower($_smarty_tpl->tpl_vars['product']->value['status'], 'UTF-8'), ENT_QUOTES, 'UTF-8');
                ?>
" /></td>
    <?php 
                if ($_smarty_tpl->tpl_vars['search']->value['cid'] && $_smarty_tpl->tpl_vars['search']->value['subcats'] != "Y") {
                    ?>
    <td class="<?php 
                    if ($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value) {
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
                    }
                    ?>
">
        <input type="text" name="products_data[<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8');
                    ?>
][position]" size="3" value="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['position'], ENT_QUOTES, 'UTF-8');
                    ?>
" class="input-micro" /></td>
    <?php 
                }
                ?>
    <td>
        <?php 
                echo $_smarty_tpl->getSubTemplate("common/image.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('image' => ($tmp = @$_smarty_tpl->tpl_vars['product']->value['main_pair']['icon']) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['product']->value['main_pair']['detailed'] : $tmp, 'image_id' => $_smarty_tpl->tpl_vars['product']->value['main_pair']['image_id'], 'image_width' => 50, 'href' => fn_url("products.update?product_id=" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id'])), 0);
                ?>

    </td>
    <td>
        <input type="hidden" name="products_data[<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8');
                ?>
][product]" value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product'], ENT_QUOTES, 'UTF-8');
                ?>
" <?php 
                if ($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value) {
                    ?>
 class="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
                    ?>
"<?php 
                }
                ?>
 />
        <a class="row-status" href="<?php 
                echo htmlspecialchars(fn_url("products.update?product_id=" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id']), ENT_QUOTES, 'UTF-8');
                ?>
"><?php 
                echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['product']->value['product'], 40);
                ?>
</a>
        <div class="product-code">
            <span class="product-code-label row-status"><?php 
                echo $_smarty_tpl->__("sku");
                ?>
 </span>
            <input type="text" name="products_data[<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8');
                ?>
][product_code]" size="15" maxlength="32" value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_code'], ENT_QUOTES, 'UTF-8');
                ?>
" class="input-hidden span2" />
        </div>
        <?php 
                echo $_smarty_tpl->getSubTemplate("views/companies/components/company_name.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object' => $_smarty_tpl->tpl_vars['product']->value), 0);
                ?>

    </td>
    <td class="<?php 
                if ($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value) {
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
                }
                ?>
">
        <?php 
                echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "price_" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id'], 'name' => "update_all_vendors[price][" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id'] . "]"), 0);
                ?>

        <input type="text" name="products_data[<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8');
                ?>
][price]" size="6" value="<?php 
                echo htmlspecialchars(fn_format_price($_smarty_tpl->tpl_vars['product']->value['price'], $_smarty_tpl->tpl_vars['primary_currency']->value, null, false), ENT_QUOTES, 'UTF-8');
                ?>
" class="input-mini input-hidden"/>
    </td>
    <td>
        <input type="text" name="products_data[<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8');
                ?>
][list_price]" size="6" value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['list_price'], ENT_QUOTES, 'UTF-8');
                ?>
" class="input-mini input-hidden" /></td>
    <?php 
                if ($_smarty_tpl->tpl_vars['search']->value['order_ids']) {
                    ?>
    <td><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['purchased_qty'], ENT_QUOTES, 'UTF-8');
                    ?>
</td>
    <td><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['purchased_subtotal'], ENT_QUOTES, 'UTF-8');
                    ?>
</td>
    <?php 
                }
                ?>
    <td>
        <?php 
                if ($_smarty_tpl->tpl_vars['product']->value['tracking'] == smarty_modifier_enum("ProductTracking::TRACK_WITH_OPTIONS")) {
                    ?>
        <?php 
                    echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("edit"), 'but_href' => "product_options.inventory?product_id=" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id'], 'but_role' => "edit"), 0);
                    ?>

        <?php 
                } else {
                    ?>
        <input type="text" name="products_data[<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['product_id'], ENT_QUOTES, 'UTF-8');
                    ?>
][amount]" size="6" value="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['amount'], ENT_QUOTES, 'UTF-8');
                    ?>
" class="input-micro input-hidden" />
        <?php 
                }
                ?>
    </td>
    <td><?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:manage_body"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "products:manage_body"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "products:manage_body"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>
</td>
    <td class="nowrap">
        <div class="hidden-tools">
            <?php 
                $_smarty_tpl->_capture_stack[0][] = array("tools_list", null, null);
                ob_start();
                ?>
                <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:list_extra_links"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "products:list_extra_links"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    ?>

                    <li><?php 
                    smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("edit"), 'href' => "products.update?product_id=" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id']));
                    ?>
</li>
                    <?php 
                    if (!$_smarty_tpl->tpl_vars['hide_inputs_if_shared_product']->value) {
                        ?>
                        <li><?php 
                        smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("delete"), 'class' => "cm-confirm cm-post", 'href' => "products.delete?product_id=" . (string) $_smarty_tpl->tpl_vars['product']->value['product_id']));
                        ?>
</li>
                    <?php 
                    }
                    ?>
                <?php 
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "products:list_extra_links"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

            <?php 
                list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                if (!empty($_capture_buffer)) {
                    if (isset($_capture_assign)) {
                        $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                    }
                    if (isset($_capture_append)) {
                        $_smarty_tpl->append($_capture_append, ob_get_contents());
                    }
                    Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                } else {
                    $_smarty_tpl->capture_error();
                }
                ?>
            <?php 
                smarty_template_function_dropdown($_smarty_tpl, array('content' => Smarty::$_smarty_vars['capture']['tools_list']));
                ?>

        </div>
    </td>
    <td class="right nowrap">
    <?php 
                echo $_smarty_tpl->getSubTemplate("common/select_popup.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('popup_additional_class' => "dropleft", 'id' => $_smarty_tpl->tpl_vars['product']->value['product_id'], 'status' => $_smarty_tpl->tpl_vars['product']->value['status'], 'hidden' => true, 'object_id_name' => "product_id", 'table' => "products"), 0);
                ?>

    </td>
</tr>
<?php 
            }
            ?>
</table>
<?php 
        } else {
            ?>
    <p class="no-items"><?php 
            echo $_smarty_tpl->__("no_data");
            ?>
</p>
<?php 
        }
        ?>

<?php 
        $_smarty_tpl->_capture_stack[0][] = array("select_fields_to_edit", null, null);
        ob_start();
        ?>

<p><?php 
        echo $_smarty_tpl->__("text_select_fields2edit_note");
        ?>
</p>
<?php 
        echo $_smarty_tpl->getSubTemplate("views/products/components/products_select_fields.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>


<div class="buttons-container">
    <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/save_cancel.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("modify_selected"), 'but_name' => "dispatch[products.store_selection]", 'cancel_action' => "close"), 0);
        ?>

</div>
<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>

<?php 
        $_smarty_tpl->_capture_stack[0][] = array("buttons", null, null);
        ob_start();
        ?>
    <?php 
        $_smarty_tpl->_capture_stack[0][] = array("tools_list", null, null);
        ob_start();
        ?>
        <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:action_buttons"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:action_buttons"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

        <li><?php 
            smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("global_update"), 'href' => "products.global_update"));
            ?>
</li>
        <li><?php 
            smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("bulk_product_addition"), 'href' => "products.m_add"));
            ?>
</li>
        <li><?php 
            smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("product_subscriptions"), 'href' => "products.p_subscr"));
            ?>
</li>
		<?php 
            if ($_smarty_tpl->tpl_vars['products']->value) {
                ?>
            <li class="divider"></li>
            <li><?php 
                smarty_template_function_btn($_smarty_tpl, array('type' => "dialog", 'class' => "cm-process-items", 'text' => __("edit_selected"), 'target_id' => "content_select_fields_to_edit", 'form' => "manage_products_form"));
                ?>
</li>
            <li><?php 
                smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("clone_selected"), 'dispatch' => "dispatch[products.m_clone]", 'form' => "manage_products_form"));
                ?>
</li>
            <li><?php 
                smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("export_selected"), 'dispatch' => "dispatch[products.export_range]", 'form' => "manage_products_form"));
                ?>
</li>
            <li><?php 
                smarty_template_function_btn($_smarty_tpl, array('type' => "delete_selected", 'dispatch' => "dispatch[products.m_delete]", 'form' => "manage_products_form"));
                ?>
</li>
        <?php 
            }
            ?>
        <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:action_buttons"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

    <?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>
    <?php 
        smarty_template_function_dropdown($_smarty_tpl, array('content' => Smarty::$_smarty_vars['capture']['tools_list']));
        ?>

    <?php 
        if ($_smarty_tpl->tpl_vars['products']->value) {
            ?>
        <?php 
            echo $_smarty_tpl->getSubTemplate("buttons/save.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_name' => "dispatch[products.m_update]", 'but_role' => "submit-button", 'but_target_form' => "manage_products_form"), 0);
            ?>

    <?php 
        }
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>

<?php 
        $_smarty_tpl->_capture_stack[0][] = array("adv_buttons", null, null);
        ob_start();
        ?>
    <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:manage_tools"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:manage_tools"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

        <?php 
            echo $_smarty_tpl->getSubTemplate("common/tools.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tool_href' => "products.add", 'prefix' => "top", 'title' => __("add_product"), 'hide_tools' => true, 'icon' => "icon-plus"), 0);
            ?>

    <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:manage_tools"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>

<?php 
        echo $_smarty_tpl->getSubTemplate("common/popupbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "select_fields_to_edit", 'text' => __("select_fields_to_edit"), 'content' => Smarty::$_smarty_vars['capture']['select_fields_to_edit']), 0);
        ?>


<div class="clearfix">
    <?php 
        echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('div_id' => $_REQUEST['content_id']), 0);
        ?>

</div>

</form>

<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>

<?php 
        $_smarty_tpl->_capture_stack[0][] = array("sidebar", null, null);
        ob_start();
        ?>
    <?php 
        echo $_smarty_tpl->getSubTemplate("common/saved_search.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('dispatch' => "products.manage", 'view_type' => "products"), 0);
        ?>

    <?php 
        echo $_smarty_tpl->getSubTemplate("views/products/components/products_search_form.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('dispatch' => "products.manage"), 0);
        ?>

<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>

<?php 
        echo $_smarty_tpl->getSubTemplate("common/mainbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("products"), 'content' => Smarty::$_smarty_vars['capture']['mainbox'], 'title_extra' => Smarty::$_smarty_vars['capture']['title_extra'], 'adv_buttons' => Smarty::$_smarty_vars['capture']['adv_buttons'], 'select_languages' => true, 'buttons' => Smarty::$_smarty_vars['capture']['buttons'], 'sidebar' => Smarty::$_smarty_vars['capture']['sidebar'], 'content_id' => "manage_products"), 0);
    }
コード例 #14
0
         unset($_SESSION['thaiepay_refno']);
     } else {
         if ($mode == 'finish') {
             fn_order_placement_routines('checkout_redirect');
         }
         exit;
     }
 }
 $order_id = intval($_REQUEST['refno']);
 if (fn_check_payment_script('thaiepay.php', $order_id, $processor_data)) {
     if ($mode == 'notify') {
         $errors = array();
         $errors_desc = array('additional_parameter' => __('additional_parameter_not_correct'), 'total' => __('order_total_not_correct'));
         if (isset($_REQUEST['total'])) {
             $order_info = fn_get_order_info($order_id);
             if (fn_format_price($order_info['total']) != fn_format_price($_REQUEST['total'])) {
                 $errors['total'] = true;
             }
         }
         $param_name = !empty($processor_data['processor_params']['add_param_name']) ? $processor_data['processor_params']['add_param_name'] : '';
         $param_value = !empty($processor_data['processor_params']['add_param_value']) ? $processor_data['processor_params']['add_param_value'] : '';
         $sec_param = !empty($param_name) && !empty($_REQUEST[$param_name]) ? $_REQUEST[$param_name] : '';
         if (empty($param_value) || empty($sec_param) || $sec_param != $param_value) {
             $errors['additional_parameter'] = true;
         }
         $pp_response = array();
         $pp_response['reason_text'] = __('order_id') . '-' . $order_id;
         $pp_response['transaction_id'] = '';
         if ($errors) {
             $pp_response['order_status'] = 'F';
             foreach ($errors as $error => $v) {
コード例 #15
0
ファイル: ideal_basic.php プロジェクト: askzap/ultimate
 if (!empty($order_info['use_gift_certificates'])) {
     foreach ($order_info['use_gift_certificates'] as $gc_code => $gc_data) {
         $amount = fn_format_price($gc_data['amount']) * 100 * -1;
         $post_data['itemNumber' . $counter] = $gc_data['gift_cert_id'];
         $post_data['itemDescription' . $counter] = $gc_code;
         $post_data['itemQuantity' . $counter] = 1;
         $post_data['itemPrice' . $counter] = $amount;
         $counter++;
     }
 }
 // Taxes
 if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') != 'unit_price') {
     $msg = __('tax');
     foreach ($order_info['taxes'] as $tax_id => $tax_data) {
         if ($tax_data['price_includes_tax'] == 'N') {
             $amount = fn_format_price($tax_data['tax_subtotal']) * 100;
             $post_data['itemNumber' . $counter] = $tax_id;
             $post_data['itemDescription' . $counter] = $msg;
             $post_data['itemQuantity' . $counter] = 1;
             $post_data['itemPrice' . $counter] = $amount;
             $counter++;
         }
     }
 }
 // Shipping
 $shipping = $order_info['shipping_cost'];
 if ($shipping > 0) {
     $ship = $order_info['shipping_cost'] * 100;
     $post_data['itemNumber' . $counter] = 'SH';
     $post_data['itemDescription' . $counter] = 'Shipping';
     $post_data['itemQuantity' . $counter] = 1;
コード例 #16
0
ファイル: fondy.php プロジェクト: cloudipsp/cscart
            if ($_REQUEST['order_status'] == FondyCls::ORDER_APPROVED) {
                $pp_response['order_status'] = 'P';
                $pp_response['reason_text'] = __('transaction_approved');
                $pp_response['transaction_id'] = $_REQUEST['payment_id'];
                if (fn_check_payment_script('fondy.php', $order_id)) {
                    fn_finish_payment($order_id, $pp_response);
                    fn_order_placement_routines('route', $order_id);
                }
            }
        }
    } elseif ($mode == 'sucsses' && !empty($_REQUEST['order_id'])) {
        if ($response == true && $order_info['status'] == 'N') {
            if ($_REQUEST['order_status'] == FondyCls::ORDER_APPROVED) {
                $pp_response['order_status'] = 'P';
                $pp_response['reason_text'] = __('transaction_approved');
                $pp_response['transaction_id'] = $_REQUEST['payment_id'];
                fn_finish_payment($order_id, $pp_response);
            }
        }
    }
    exit;
} else {
    $payment_url = FondyCls::URL;
    $amount = fn_format_price($order_info['total'], $processor_data['processor_params']['currency']);
    $confirm_url = fn_url("payment_notification.sucsses?payment=fondy&order_id={$order_id}", AREA, 'current');
    $response_url = fn_url("payment_notification.response?payment=fondy&order_id={$order_id}", AREA, 'current');
    $post_data = array('merchant_id' => $processor_data['processor_params']['fondy_merchantid'], 'lang' => $processor_data['processor_params']['fondy_lang'], 'order_id' => time() . $order_id, 'order_desc' => '#' . $order_id, 'amount' => round($amount * 100), 'currency' => $processor_data['processor_params']['currency'], 'server_callback_url' => $confirm_url, 'response_url' => $response_url);
    $post_data['signature'] = FondyCls::getSignature($post_data, $processor_data['processor_params']['fondy_merchnatSecretKey']);
    fn_create_payment_form($payment_url, $post_data, 'Fondy', false);
    exit;
}
    function content_55e61f9ae0ca45_28054294($_smarty_tpl)
    {
        if (!is_callable('smarty_block_hook')) {
            include '/var/www/html/market/app/functions/smarty_plugins/block.hook.php';
        }
        if (!is_callable('smarty_function_math')) {
            include '/var/www/html/market/app/lib/vendor/smarty/smarty/libs/plugins/function.math.php';
        }
        if (!is_callable('smarty_modifier_enum')) {
            include '/var/www/html/market/app/functions/smarty_plugins/modifier.enum.php';
        }
        if (!is_callable('smarty_modifier_in_array')) {
            include '/var/www/html/market/app/functions/smarty_plugins/modifier.in_array.php';
        }
        fn_preload_lang_vars(array('information', 'name', 'text_ult_product_store_field_tooltip', 'categories', 'tt_views_products_update_categories', 'price', 'full_description', 'edit_content_on_site', 'images', 'text_product_thumbnail', 'text_product_detailed_image', 'options_settings', 'options_type', 'simultaneous', 'sequential', 'exceptions_type', 'forbidden', 'allowed', 'pricing_inventory', 'sku', 'list_price', 'tt_views_products_update_list_price', 'in_stock', 'edit', 'zero_price_action', 'zpa_refuse', 'zpa_permit', 'zpa_ask_price', 'inventory', 'tt_views_products_update_inventory', 'track_with_options', 'track_without_options', 'dont_track', 'min_order_qty', 'max_order_qty', 'quantity_step', 'list_quantity_count', 'taxes', 'availability', 'usergroups', 'creation_date', 'available_since', 'out_of_stock_actions', 'tt_views_products_update_out_of_stock_actions', 'none', 'buy_in_advance', 'sign_up_for_notification', 'extra', 'product_details_view', 'feature_comparison', 'downloadable', 'edp_enable_shipping', 'time_unlimited_download', 'short_description', 'popularity', 'ttc_popularity', 'search_words', 'promo_text', 'additional_images', 'sort_images', 'sort', 'additional_thumbnail', 'additional_popup_larger_image', 'text_additional_thumbnail', 'text_additional_detailed_image', 'additional_thumbnail', 'additional_popup_larger_image', 'text_additional_thumbnail', 'text_additional_detailed_image', 'seo_meta_data', 'page_title', 'ttc_page_title', 'meta_description', 'meta_keywords', 'preview', 'clone', 'delete', 'editing_product', 'new_product'));
        $_smarty_tpl->_capture_stack[0][] = array("mainbox", null, null);
        ob_start();
        ?>

    <?php 
        $_smarty_tpl->_capture_stack[0][] = array("tabsbox", null, null);
        ob_start();
        ?>
        

        <?php 
        $_smarty_tpl->tpl_vars["categories_company_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['product_data']->value['company_id'], null, 0);
        ?>
        <?php 
        $_smarty_tpl->tpl_vars["allow_save"] = new Smarty_variable(fn_allow_save_object($_smarty_tpl->tpl_vars['product_data']->value, "product"), null, 0);
        ?>

        <?php 
        if (fn_allowed_for("ULTIMATE")) {
            ?>
            <?php 
            $_smarty_tpl->tpl_vars["categories_company_id"] = new Smarty_variable('', null, 0);
            ?>
            <?php 
            if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && $_smarty_tpl->tpl_vars['product_data']->value['shared_product'] == "Y" && $_smarty_tpl->tpl_vars['product_data']->value['company_id'] != $_smarty_tpl->tpl_vars['runtime']->value['company_id']) {
                ?>
                <?php 
                $_smarty_tpl->tpl_vars["no_hide_input_if_shared_product"] = new Smarty_variable("cm-no-hide-input", null, 0);
                ?>
            <?php 
            }
            ?>

            <?php 
            if (!$_smarty_tpl->tpl_vars['runtime']->value['company_id'] && $_smarty_tpl->tpl_vars['product_data']->value['shared_product'] == "Y") {
                ?>
                <?php 
                $_smarty_tpl->tpl_vars["show_update_for_all"] = new Smarty_variable(true, null, 0);
                ?>
            <?php 
            }
            ?>
        <?php 
        }
        ?>

        <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['product_id']) {
            ?>
            <?php 
            $_smarty_tpl->tpl_vars["id"] = new Smarty_variable($_smarty_tpl->tpl_vars['product_data']->value['product_id'], null, 0);
            ?>
        <?php 
        } else {
            ?>
            <?php 
            $_smarty_tpl->tpl_vars["id"] = new Smarty_variable(0, null, 0);
            ?>
        <?php 
        }
        ?>
        <form id='form' action="<?php 
        echo htmlspecialchars(fn_url(''), ENT_QUOTES, 'UTF-8');
        ?>
" method="post" name="product_update_form" class="form-horizontal form-edit  cm-disable-empty-files <?php 
        if (fn_check_form_permissions('') || $_smarty_tpl->tpl_vars['runtime']->value['company_id'] && $_smarty_tpl->tpl_vars['product_data']->value['shared_product'] == "Y" && $_smarty_tpl->tpl_vars['product_data']->value['company_id'] != $_smarty_tpl->tpl_vars['runtime']->value['company_id']) {
            ?>
 cm-hide-inputs<?php 
        }
        ?>
" enctype="multipart/form-data"> 
            <input type="hidden" name="fake" value="1" />
            <input type="hidden" class="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
" name="selected_section" id="selected_section" value="<?php 
        echo htmlspecialchars($_REQUEST['selected_section'], ENT_QUOTES, 'UTF-8');
        ?>
" />
            <input type="hidden" class="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
" name="product_id" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8');
        ?>
" />

            

            <div class="product-manage" id="content_detailed"> 

                
                <?php 
        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("information"), 'target' => "#acc_information"), 0);
        ?>


                <div id="acc_information" class="collapse in">

                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
                        <label for="product_description_product" class="control-label cm-required"><?php 
        echo $_smarty_tpl->__("name");
        ?>
</label>
                        <div class="controls">
                            <input class="input-large" form="form" type="text" name="product_data[product]" id="product_description_product" size="55" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['product'], ENT_QUOTES, 'UTF-8');
        ?>
" />
                            <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => 'product', 'name' => "update_all_vendors[product]"), 0);
        ?>

                        </div>
                    </div>

                    <?php 
        $_smarty_tpl->tpl_vars["result_ids"] = new Smarty_variable("product_categories", null, 0);
        ?>

                    <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "companies:product_details_fields"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "companies:product_details_fields"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

                    <?php 
            if (fn_allowed_for("MULTIVENDOR") && $_smarty_tpl->tpl_vars['mode']->value != "add") {
                ?>
                        <?php 
                $_smarty_tpl->tpl_vars["reload_form"] = new Smarty_variable(true, null, 0);
                ?>
                    <?php 
            }
            ?>

                    <?php 
            if (fn_allowed_for("ULTIMATE")) {
                ?>
                        <?php 
                $_smarty_tpl->tpl_vars["companies_tooltip"] = new Smarty_variable($_smarty_tpl->__("text_ult_product_store_field_tooltip"), null, 0);
                ?>
                    <?php 
            }
            ?>

                    <?php 
            echo $_smarty_tpl->getSubTemplate("views/companies/components/company_field.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('name' => "product_data[company_id]", 'id' => "product_data_company_id", 'selected' => $_smarty_tpl->tpl_vars['product_data']->value['company_id'], 'tooltip' => $_smarty_tpl->tpl_vars['companies_tooltip']->value, 'reload_form' => $_smarty_tpl->tpl_vars['reload_form']->value), 0);
            ?>


                    <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "companies:product_details_fields"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>


                    <input type="hidden" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['result_ids']->value, ENT_QUOTES, 'UTF-8');
        ?>
" name="result_ids">

                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
" id="product_categories">
                        <?php 
        echo smarty_function_math(array('equation' => "rand()", 'assign' => "rnd"), $_smarty_tpl);
        ?>

                        <?php 
        if ($_REQUEST['category_id']) {
            ?>
                            <?php 
            $_smarty_tpl->tpl_vars["request_category_id"] = new Smarty_variable(explode(",", $_REQUEST['category_id']), null, 0);
            ?>
                        <?php 
        } else {
            ?>
                            <?php 
            $_smarty_tpl->tpl_vars["request_category_id"] = new Smarty_variable('', null, 0);
            ?>
                        <?php 
        }
        ?>
                        <label for="ccategories_<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['rnd']->value, ENT_QUOTES, 'UTF-8');
        ?>
_ids" class="control-label cm-required"><?php 
        echo $_smarty_tpl->__("categories");
        echo $_smarty_tpl->getSubTemplate("common/tooltip.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tooltip' => __("tt_views_products_update_categories")), 0);
        ?>
</label>
                        <div class="controls">
                            <?php 
        echo $_smarty_tpl->getSubTemplate("pickers/categories/picker.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('hide_input' => $_smarty_tpl->tpl_vars['product_data']->value['shared_product'], 'company_ids' => $_smarty_tpl->tpl_vars['product_data']->value['company_id'], 'rnd' => $_smarty_tpl->tpl_vars['rnd']->value, 'data_id' => "categories", 'input_name' => "product_data[category_ids]", 'radio_input_name' => "product_data[main_category]", 'main_category' => $_smarty_tpl->tpl_vars['product_data']->value['main_category'], 'item_ids' => ($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['category_ids']) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['request_category_id']->value : $tmp, 'hide_link' => true, 'hide_delete_button' => true, 'display_input_id' => "category_ids", 'disable_no_item_text' => true, 'view_mode' => "list", 'but_meta' => "btn"), 0);
        ?>

                        </div>
                    <!--product_categories--></div>

                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
                        <label for="elm_price_price" class="control-label cm-required"><?php 
        echo $_smarty_tpl->__("price");
        ?>
 (<?php 
        echo $_smarty_tpl->tpl_vars['currencies']->value[$_smarty_tpl->tpl_vars['primary_currency']->value]['symbol'];
        ?>
):</label>
                        <div class="controls">
                            <input type="text" name="product_data[price]" id="elm_price_price" size="10" value="<?php 
        echo htmlspecialchars(fn_format_price(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['price']) === null || $tmp === '' ? "0.00" : $tmp, $_smarty_tpl->tpl_vars['primary_currency']->value, null, false), ENT_QUOTES, 'UTF-8');
        ?>
" class="input-long" />
                            <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => 'price', 'name' => "update_all_vendors[price]"), 0);
        ?>

                        </div>
                    </div>

                    <div class="control-group cm-no-hide-input">
                        <label class="control-label" for="elm_product_full_descr"><?php 
        echo $_smarty_tpl->__("full_description");
        ?>
:</label>
                        <div class="controls">
                            <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => 'full_description', 'name' => "update_all_vendors[full_description]"), 0);
        ?>

                            <textarea id="elm_product_full_descr" name="product_data[full_description]" cols="55" rows="8" class="cm-wysiwyg input-large"><?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['full_description'], ENT_QUOTES, 'UTF-8');
        ?>
</textarea>

                            <?php 
        if ($_smarty_tpl->tpl_vars['view_uri']->value) {
            ?>
                                <?php 
            ob_start();
            echo htmlspecialchars(urlencode($_smarty_tpl->tpl_vars['view_uri']->value), ENT_QUOTES, 'UTF-8');
            $_tmp1 = ob_get_clean();
            ob_start();
            if (fn_allowed_for("ULTIMATE")) {
                echo "&switch_company_id=";
                echo (string) $_smarty_tpl->tpl_vars['product_data']->value['company_id'];
            }
            $_tmp2 = ob_get_clean();
            echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_href' => "customization.update_mode?type=live_editor&status=enable&frontend_url=" . $_tmp1 . $_tmp2, 'but_text' => __("edit_content_on_site"), 'but_role' => "action", 'but_meta' => "btn-small btn-live-edit cm-post", 'but_target' => "_blank"), 0);
            ?>

                            <?php 
        }
        ?>
                        </div>
                    </div>
                    

                    <?php 
        echo $_smarty_tpl->getSubTemplate("common/select_status.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('input_name' => "product_data[status]", 'id' => "elm_product_status", 'obj' => $_smarty_tpl->tpl_vars['product_data']->value, 'hidden' => true), 0);
        ?>


                    <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:update_detailed_images"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:update_detailed_images"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

                    <div class="control-group">
                        <label class="control-label"><?php 
            echo $_smarty_tpl->__("images");
            ?>
:</label>
                        <div class="controls">
                            <?php 
            echo $_smarty_tpl->getSubTemplate("common/attach_images.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('image_name' => "product_main", 'image_object_type' => "product", 'image_pair' => $_smarty_tpl->tpl_vars['product_data']->value['main_pair'], 'icon_text' => __("text_product_thumbnail"), 'detailed_text' => __("text_product_detailed_image"), 'no_thumbnail' => true), 0);
            ?>

                        </div>
                    </div>
                    <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:update_detailed_images"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>


                </div>

                <hr>

                <?php 
        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("options_settings"), 'target' => "#acc_options"), 0);
        ?>

                <?php 
        if (fn_allowed_for("ULTIMATE:FREE")) {
            ?>
                    <?php 
            $_smarty_tpl->tpl_vars['promo_class'] = new Smarty_variable("cm-promo-popup", null, 0);
            ?>
                    <?php 
            $_smarty_tpl->tpl_vars['disable_selectors'] = new Smarty_variable(true, null, 0);
            ?>
                <?php 
        }
        ?>

                <div id="acc_options" class="collapse in">
                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['promo_class']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
                        <label class="control-label" for="elm_options_type"><?php 
        echo $_smarty_tpl->__("options_type");
        ?>
:</label>
                        <div class="controls">
                            <select class="span3" name="product_data[options_type]" id="elm_options_type" <?php 
        if ($_smarty_tpl->tpl_vars['disable_selectors']->value) {
            ?>
disabled="disabled"<?php 
        }
        ?>
>
                                <option value="P" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['options_type'] == "P") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("simultaneous");
        ?>
</option>
                                <option value="S" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['options_type'] == "S") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("sequential");
        ?>
</option>
                            </select>
                        </div>
                    </div>
                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['promo_class']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
                        <label class="control-label" for="elm_exceptions_type"><?php 
        echo $_smarty_tpl->__("exceptions_type");
        ?>
:</label>
                        <div class="controls">
                            <select class="span3" name="product_data[exceptions_type]" id="elm_exceptions_type" <?php 
        if ($_smarty_tpl->tpl_vars['disable_selectors']->value) {
            ?>
disabled="disabled"<?php 
        }
        ?>
>
                                <option value="F" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['exceptions_type'] == "F") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("forbidden");
        ?>
</option>
                                <option value="A" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['exceptions_type'] == "A") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("allowed");
        ?>
</option>
                            </select>
                        </div>
                    </div>
                </div>

                <hr>

                <?php 
        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("pricing_inventory"), 'target' => "#acc_pricing_inventory"), 0);
        ?>

                <div id="acc_pricing_inventory" class="collapse in">
                    <div class="control-group">
                        <label class="control-label" for="elm_product_code"><?php 
        echo $_smarty_tpl->__("sku");
        ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[product_code]" id="elm_product_code" size="20" maxlength="32"  value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['product_code'], ENT_QUOTES, 'UTF-8');
        ?>
" class="input-long" />
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_list_price"><?php 
        echo $_smarty_tpl->__("list_price");
        ?>
 (<?php 
        echo $_smarty_tpl->tpl_vars['currencies']->value[$_smarty_tpl->tpl_vars['primary_currency']->value]['symbol'];
        ?>
) <?php 
        echo $_smarty_tpl->getSubTemplate("common/tooltip.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tooltip' => __("tt_views_products_update_list_price")), 0);
        ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[list_price]" id="elm_list_price" size="10" value="<?php 
        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['list_price']) === null || $tmp === '' ? "0.00" : $tmp, ENT_QUOTES, 'UTF-8');
        ?>
" class="input-long" />
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_in_stock"><?php 
        echo $_smarty_tpl->__("in_stock");
        ?>
:</label>
                        <div class="controls">
                            <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['tracking'] == smarty_modifier_enum("ProductTracking::TRACK_WITH_OPTIONS")) {
            ?>
                                <?php 
            echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("edit"), 'but_href' => "product_options.inventory?product_id=" . (string) $_smarty_tpl->tpl_vars['id']->value, 'but_role' => "edit"), 0);
            ?>

                            <?php 
        } else {
            ?>
                                <input type="text" name="product_data[amount]" id="elm_in_stock" size="10" value="<?php 
            echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['amount']) === null || $tmp === '' ? "1" : $tmp, ENT_QUOTES, 'UTF-8');
            ?>
" class="input-small" />
                            <?php 
        }
        ?>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_zero_price_action"><?php 
        echo $_smarty_tpl->__("zero_price_action");
        ?>
:</label>
                        <div class="controls">
                            <select class="span5" name="product_data[zero_price_action]" id="elm_zero_price_action">
                                <option value="R" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['zero_price_action'] == "R") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("zpa_refuse");
        ?>
</option>
                                <option value="P" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['zero_price_action'] == "P") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("zpa_permit");
        ?>
</option>
                                <option value="A" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['zero_price_action'] == "A") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("zpa_ask_price");
        ?>
</option>
                            </select>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_product_tracking"><?php 
        echo $_smarty_tpl->__("inventory");
        echo $_smarty_tpl->getSubTemplate("common/tooltip.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tooltip' => __("tt_views_products_update_inventory")), 0);
        ?>
:</label>
                        <div class="controls">
                            <select class="span3" name="product_data[tracking]" id="elm_product_tracking" <?php 
        if ($_smarty_tpl->tpl_vars['settings']->value['General']['inventory_tracking'] == "N") {
            ?>
disabled="disabled"<?php 
        }
        ?>
>
                                <?php 
        if ($_smarty_tpl->tpl_vars['product_options']->value) {
            ?>
                                    <option value="<?php 
            echo htmlspecialchars(smarty_modifier_enum("ProductTracking::TRACK_WITH_OPTIONS"), ENT_QUOTES, 'UTF-8');
            ?>
" <?php 
            if ($_smarty_tpl->tpl_vars['product_data']->value['tracking'] == smarty_modifier_enum("ProductTracking::TRACK_WITH_OPTIONS") && $_smarty_tpl->tpl_vars['settings']->value['General']['inventory_tracking'] == "Y") {
                ?>
selected="selected"<?php 
            }
            ?>
><?php 
            echo $_smarty_tpl->__("track_with_options");
            ?>
</option>
                                <?php 
        }
        ?>
                                <option value="<?php 
        echo htmlspecialchars(smarty_modifier_enum("ProductTracking::TRACK_WITHOUT_OPTIONS"), ENT_QUOTES, 'UTF-8');
        ?>
" <?php 
        ob_start();
        echo htmlspecialchars(smarty_modifier_enum("ProductTracking::TRACK_WITHOUT_OPTIONS"), ENT_QUOTES, 'UTF-8');
        $_tmp3 = ob_get_clean();
        if ($_smarty_tpl->tpl_vars['product_data']->value['tracking'] == $_tmp3 && $_smarty_tpl->tpl_vars['settings']->value['General']['inventory_tracking'] == "Y") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("track_without_options");
        ?>
</option>
                                <option value="<?php 
        echo htmlspecialchars(smarty_modifier_enum("ProductTracking::DO_NOT_TRACK"), ENT_QUOTES, 'UTF-8');
        ?>
" <?php 
        ob_start();
        echo htmlspecialchars(smarty_modifier_enum("ProductTracking::DO_NOT_TRACK"), ENT_QUOTES, 'UTF-8');
        $_tmp4 = ob_get_clean();
        if ($_smarty_tpl->tpl_vars['product_data']->value['tracking'] == $_tmp4 || $_smarty_tpl->tpl_vars['settings']->value['General']['inventory_tracking'] == "N") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("dont_track");
        ?>
</option>
                            </select>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_min_qty"><?php 
        echo $_smarty_tpl->__("min_order_qty");
        ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[min_qty]" size="10" id="elm_min_qty" value="<?php 
        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['min_qty']) === null || $tmp === '' ? "0" : $tmp, ENT_QUOTES, 'UTF-8');
        ?>
" class="input-small" />
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_max_qty"><?php 
        echo $_smarty_tpl->__("max_order_qty");
        ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[max_qty]" id="elm_max_qty" size="10" value="<?php 
        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['max_qty']) === null || $tmp === '' ? "0" : $tmp, ENT_QUOTES, 'UTF-8');
        ?>
" class="input-small" />
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_qty_step"><?php 
        echo $_smarty_tpl->__("quantity_step");
        ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[qty_step]" id="elm_qty_step" size="10" value="<?php 
        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['qty_step']) === null || $tmp === '' ? "0" : $tmp, ENT_QUOTES, 'UTF-8');
        ?>
" class="input-small" />
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_list_qty_count"><?php 
        echo $_smarty_tpl->__("list_quantity_count");
        ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[list_qty_count]" id="elm_list_qty_count" size="10" value="<?php 
        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['list_qty_count']) === null || $tmp === '' ? "0" : $tmp, ENT_QUOTES, 'UTF-8');
        ?>
" class="input-small" />
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label"><?php 
        echo $_smarty_tpl->__("taxes");
        ?>
:</label>
                        <div class="controls">
                            <input type="hidden" name="product_data[tax_ids]" value="" />
                            <?php 
        $_smarty_tpl->tpl_vars["tax"] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars["tax"]->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['taxes']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars["tax"]->key => $_smarty_tpl->tpl_vars["tax"]->value) {
            $_smarty_tpl->tpl_vars["tax"]->_loop = true;
            ?>
                                <label class="checkbox inline" for="elm_taxes_<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['tax']->value['tax_id'], ENT_QUOTES, 'UTF-8');
            ?>
">
                                    <input type="checkbox" name="product_data[tax_ids][<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['tax']->value['tax_id'], ENT_QUOTES, 'UTF-8');
            ?>
]" id="elm_taxes_<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['tax']->value['tax_id'], ENT_QUOTES, 'UTF-8');
            ?>
" <?php 
            if (smarty_modifier_in_array($_smarty_tpl->tpl_vars['tax']->value['tax_id'], $_smarty_tpl->tpl_vars['product_data']->value['tax_ids'])) {
                ?>
checked="checked"<?php 
            }
            ?>
 value="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['tax']->value['tax_id'], ENT_QUOTES, 'UTF-8');
            ?>
" />
                                    <?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['tax']->value['tax'], ENT_QUOTES, 'UTF-8');
            ?>
</label>
                                <?php 
        }
        if (!$_smarty_tpl->tpl_vars["tax"]->_loop) {
            ?>
                                &ndash;
                            <?php 
        }
        ?>
                        </div>
                    </div>
                </div>

                <hr>
                <?php 
        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("availability"), 'target' => "#acc_availability"), 0);
        ?>

                <div id="acc_availability" class="collapse in">
                    <?php 
        if (!fn_allowed_for("ULTIMATE:FREE")) {
            ?>
                        <div class="control-group">
                            <label class="control-label"><?php 
            echo $_smarty_tpl->__("usergroups");
            ?>
:</label>
                            <div class="controls">
                                <?php 
            echo $_smarty_tpl->getSubTemplate("common/select_usergroups.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "ug_id", 'name' => "product_data[usergroup_ids]", 'usergroups' => fn_get_usergroups(array("type" => "C", "status" => array("A", "H")), @constant('DESCR_SL')), 'usergroup_ids' => $_smarty_tpl->tpl_vars['product_data']->value['usergroup_ids'], 'input_extra' => '', 'list_mode' => false), 0);
            ?>

                            </div>
                        </div>
                    <?php 
        }
        ?>

                    <div class="control-group">
                        <label class="control-label" for="elm_date_holder"><?php 
        echo $_smarty_tpl->__("creation_date");
        ?>
:</label>
                        <div class="controls">
                            <?php 
        echo $_smarty_tpl->getSubTemplate("common/calendar.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('date_id' => "elm_date_holder", 'date_name' => "product_data[timestamp]", 'date_val' => ($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['timestamp']) === null || $tmp === '' ? @constant('TIME') : $tmp, 'start_year' => $_smarty_tpl->tpl_vars['settings']->value['Company']['company_start_year']), 0);
        ?>

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_date_avail_holder"><?php 
        echo $_smarty_tpl->__("available_since");
        ?>
:</label>
                        <div class="controls">
                            <?php 
        echo $_smarty_tpl->getSubTemplate("common/calendar.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('date_id' => "elm_date_avail_holder", 'date_name' => "product_data[avail_since]", 'date_val' => ($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['avail_since']) === null || $tmp === '' ? '' : $tmp, 'start_year' => $_smarty_tpl->tpl_vars['settings']->value['Company']['company_start_year']), 0);
        ?>

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_out_of_stock_actions"><?php 
        echo $_smarty_tpl->__("out_of_stock_actions");
        echo $_smarty_tpl->getSubTemplate("common/tooltip.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tooltip' => __("tt_views_products_update_out_of_stock_actions")), 0);
        ?>
:</label>
                        <div class="controls">
                            <select class="span3" name="product_data[out_of_stock_actions]" id="elm_out_of_stock_actions">
                                <option value="N" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['out_of_stock_actions'] == "N") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("none");
        ?>
</option>
                                <option value="B" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['out_of_stock_actions'] == "B") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("buy_in_advance");
        ?>
</option>
                                <option value="S" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['out_of_stock_actions'] == "S") {
            ?>
selected="selected"<?php 
        }
        ?>
><?php 
        echo $_smarty_tpl->__("sign_up_for_notification");
        ?>
</option>
                            </select>
                        </div>
                    </div>
                </div>

                <hr>

                <?php 
        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("extra"), 'target' => "#acc_extra"), 0);
        ?>

                <div id="acc_extra" class="collapse in">
                    <div class="control-group">
                        <label class="control-label" for="elm_details_layout"><?php 
        echo $_smarty_tpl->__("product_details_view");
        ?>
:</label>
                        <div class="controls">
                            <select class="span5" id="elm_details_layout" name="product_data[details_layout]">
                                <?php 
        $_smarty_tpl->tpl_vars["item"] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars["item"]->_loop = false;
        $_smarty_tpl->tpl_vars["layout"] = new Smarty_Variable();
        $_from = fn_get_product_details_views($_smarty_tpl->tpl_vars['id']->value);
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars["item"]->key => $_smarty_tpl->tpl_vars["item"]->value) {
            $_smarty_tpl->tpl_vars["item"]->_loop = true;
            $_smarty_tpl->tpl_vars["layout"]->value = $_smarty_tpl->tpl_vars["item"]->key;
            ?>
                                    <option <?php 
            if ($_smarty_tpl->tpl_vars['product_data']->value['details_layout'] == $_smarty_tpl->tpl_vars['layout']->value) {
                ?>
selected="selected"<?php 
            }
            ?>
 value="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['layout']->value, ENT_QUOTES, 'UTF-8');
            ?>
"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['item']->value, ENT_QUOTES, 'UTF-8');
            ?>
</option>
                                <?php 
        }
        ?>
                            </select>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_product_feature_comparison"><?php 
        echo $_smarty_tpl->__("feature_comparison");
        ?>
:</label>
                        <div class="controls">
                            <label class="checkbox">
                                <input type="hidden" name="product_data[feature_comparison]" value="N" />
                                <input type="checkbox" name="product_data[feature_comparison]" id="elm_product_feature_comparison" value="Y" <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['feature_comparison'] == "Y") {
            ?>
checked="checked"<?php 
        }
        ?>
/>
                            </label>
                        </div>
                    </div>

                    <?php 
        if ($_smarty_tpl->tpl_vars['settings']->value['General']['enable_edp'] == "Y") {
            ?>
                    <div class="control-group">
                        <label class="control-label" for="elm_product_is_edp"><?php 
            echo $_smarty_tpl->__("downloadable");
            ?>
:</label>
                        <div class="controls">
                            <label class="checkbox">
                                <input type="hidden" name="product_data[is_edp]" value="N" />
                                <input type="checkbox" name="product_data[is_edp]" id="elm_product_is_edp" value="Y" <?php 
            if ($_smarty_tpl->tpl_vars['product_data']->value['is_edp'] == "Y") {
                ?>
checked="checked"<?php 
            }
            ?>
 onclick="Tygh.$('#edp_shipping').toggleBy(); Tygh.$('#edp_unlimited').toggleBy();"/>
                            </label>
                        </div>
                    </div>

                    <div class="control-group <?php 
            if ($_smarty_tpl->tpl_vars['product_data']->value['is_edp'] != "Y") {
                ?>
hidden<?php 
            }
            ?>
" id="edp_shipping">
                        <label class="control-label" for="elm_product_edp_shipping"><?php 
            echo $_smarty_tpl->__("edp_enable_shipping");
            ?>
:</label>
                        <div class="controls">
                            <label class="checkbox">
                                <input type="hidden" name="product_data[edp_shipping]" value="N" />
                                <input type="checkbox" name="product_data[edp_shipping]" id="elm_product_edp_shipping" value="Y"<?php 
            if ($_smarty_tpl->tpl_vars['product_data']->value['edp_shipping'] == "Y") {
                ?>
checked="checked"<?php 
            }
            ?>
 />
                            </label>
                        </div>
                    </div>

                    <div class="control-group <?php 
            if ($_smarty_tpl->tpl_vars['product_data']->value['is_edp'] != "Y") {
                ?>
hidden<?php 
            }
            ?>
" id="edp_unlimited">
                        <label class="control-label" for="elm_product_edp_unlimited"><?php 
            echo $_smarty_tpl->__("time_unlimited_download");
            ?>
:</label>
                        <div class="controls">
                            <label class="checkbox">
                                <input type="hidden" name="product_data[unlimited_download]" value="N" />
                                <input type="checkbox" name="product_data[unlimited_download]" id="elm_product_edp_unlimited" value="Y" <?php 
            if ($_smarty_tpl->tpl_vars['product_data']->value['unlimited_download'] == "Y") {
                ?>
checked="checked"<?php 
            }
            ?>
 />
                            </label>
                        </div>
                    </div>
                    <?php 
        }
        ?>

                    <?php 
        echo $_smarty_tpl->getSubTemplate("views/localizations/components/select.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('data_from' => $_smarty_tpl->tpl_vars['product_data']->value['localization'], 'data_name' => "product_data[localization]"), 0);
        ?>


                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
                        <label class="control-label" for="elm_product_short_descr"><?php 
        echo $_smarty_tpl->__("short_description");
        ?>
:</label>
                        <div class="controls">
                            <textarea id="elm_product_short_descr" name="product_data[short_description]" cols="55" rows="2" class="cm-wysiwyg input-large"><?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['short_description'], ENT_QUOTES, 'UTF-8');
        ?>
</textarea>
                            <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "short_description", 'name' => "update_all_vendors[short_description]"), 0);
        ?>

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="elm_product_popularity"><?php 
        echo $_smarty_tpl->__("popularity");
        echo $_smarty_tpl->getSubTemplate("common/tooltip.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tooltip' => __("ttc_popularity")), 0);
        ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[popularity]" id="elm_product_popularity" size="55" value="<?php 
        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['popularity']) === null || $tmp === '' ? 0 : $tmp, ENT_QUOTES, 'UTF-8');
        ?>
" class="input-long" />
                        </div>
                    </div>

                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
                        <label class="control-label" for="elm_product_search_words"><?php 
        echo $_smarty_tpl->__("search_words");
        ?>
:</label>
                        <div class="controls">
                            <textarea name="product_data[search_words]" id="elm_product_search_words" cols="55" rows="2" class="input-large"><?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['search_words'], ENT_QUOTES, 'UTF-8');
        ?>
</textarea>
                            <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => 'search_words', 'name' => "update_all_vendors[search_words]"), 0);
        ?>

                        </div>
                    </div>

                    <div class="control-group <?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
                        <label class="control-label" for="elm_product_promo_text"><?php 
        echo $_smarty_tpl->__("promo_text");
        ?>
:</label>
                        <div class="controls">
                            <textarea id="elm_product_promo_text" name="product_data[promo_text]" cols="55" rows="2" class="cm-wysiwyg input-large"><?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['promo_text'], ENT_QUOTES, 'UTF-8');
        ?>
</textarea>
                            <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "promo_text", 'name' => "update_all_vendors[promo_text]"), 0);
        ?>

                        </div>
                    </div>
                </div>
                <!--content_detailed--></div> 

            

            
            <div id="content_images" class="hidden clearfix"> 
                <?php 
        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("additional_images")), 0);
        ?>

                <?php 
        if ($_smarty_tpl->tpl_vars['product_data']->value['image_pairs']) {
            ?>
                    <div class="cm-sortable sortable-box" data-ca-sortable-table="images_links" data-ca-sortable-id-name="pair_id" id="additional_images">
                        <?php 
            $_smarty_tpl->tpl_vars["new_image_position"] = new Smarty_variable("0", null, 0);
            ?>
                        <?php 
            $_smarty_tpl->tpl_vars['pair'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['pair']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['product_data']->value['image_pairs'];
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['pair']->key => $_smarty_tpl->tpl_vars['pair']->value) {
                $_smarty_tpl->tpl_vars['pair']->_loop = true;
                ?>
                            <div class="cm-row-item cm-sortable-id-<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['pair']->value['pair_id'], ENT_QUOTES, 'UTF-8');
                ?>
 cm-sortable-box">
                                <div class="cm-sortable-handle sortable-bar"><img src="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['images_dir']->value, ENT_QUOTES, 'UTF-8');
                ?>
/icon_sort_bar.gif" width="26" height="25" border="0" title="<?php 
                echo $_smarty_tpl->__("sort_images");
                ?>
" alt="<?php 
                echo $_smarty_tpl->__("sort");
                ?>
" class="valign" /></div>
                                <div class="sortable-item">
                                    <?php 
                echo $_smarty_tpl->getSubTemplate("common/attach_images.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('image_name' => "product_additional", 'image_object_type' => "product", 'image_key' => $_smarty_tpl->tpl_vars['pair']->value['pair_id'], 'image_type' => "A", 'image_pair' => $_smarty_tpl->tpl_vars['pair']->value, 'icon_title' => __("additional_thumbnail"), 'detailed_title' => __("additional_popup_larger_image"), 'icon_text' => __("text_additional_thumbnail"), 'detailed_text' => __("text_additional_detailed_image"), 'delete_pair' => true, 'no_thumbnail' => true), 0);
                ?>

                                </div>
                                <div class="clear"></div>
                            </div>
                            <?php 
                if ($_smarty_tpl->tpl_vars['new_image_position']->value <= $_smarty_tpl->tpl_vars['pair']->value['position']) {
                    ?>
                                <?php 
                    $_smarty_tpl->tpl_vars["new_image_position"] = new Smarty_variable($_smarty_tpl->tpl_vars['pair']->value['position'], null, 0);
                    ?>
                            <?php 
                }
                ?>
                        <?php 
            }
            ?>
                    </div>
                <?php 
        }
        ?>

                <div id="box_new_image">
                    <div class="clear cm-row-item">
                        <input type="hidden" name="product_add_additional_image_data[0][position]" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['new_image_position']->value, ENT_QUOTES, 'UTF-8');
        ?>
" class="cm-image-field" />
                        <div class="image-upload-wrap pull-left"><?php 
        echo $_smarty_tpl->getSubTemplate("common/attach_images.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('image_name' => "product_add_additional", 'image_object_type' => "product", 'image_type' => "A", 'icon_title' => __("additional_thumbnail"), 'detailed_title' => __("additional_popup_larger_image"), 'icon_text' => __("text_additional_thumbnail"), 'detailed_text' => __("text_additional_detailed_image"), 'no_thumbnail' => true), 0);
        ?>
</div>
                        <div class="pull-right"><?php 
        echo $_smarty_tpl->getSubTemplate("buttons/multiple_buttons.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('item_id' => "new_image"), 0);
        ?>
</div>
                    </div>
                </div>

            </div> 
            

            
            <div id="content_seo" class="hidden">

                <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:update_seo"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:update_seo"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

                <?php 
            echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("seo_meta_data"), 'target' => "#acc_seo_meta"), 0);
            ?>

                <div id="acc_seo_meta" class="collapse in">
                    <div class="control-group <?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
            ?>
">
                        <label class="control-label" for="elm_product_page_title"><?php 
            echo $_smarty_tpl->__("page_title");
            echo $_smarty_tpl->getSubTemplate("common/tooltip.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tooltip' => __("ttc_page_title")), 0);
            ?>
:</label>
                        <div class="controls">
                            <input type="text" name="product_data[page_title]" id="elm_product_page_title" size="55" value="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['page_title'], ENT_QUOTES, 'UTF-8');
            ?>
" class="input-large" />
                            <?php 
            echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "page_title", 'name' => "update_all_vendors[page_title]"), 0);
            ?>

                        </div>
                    </div>

                    <div class="control-group <?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
            ?>
">
                        <label class="control-label" for="elm_product_meta_descr"><?php 
            echo $_smarty_tpl->__("meta_description");
            ?>
:</label>
                        <div class="controls">
                            <textarea name="product_data[meta_description]" id="elm_product_meta_descr" cols="55" rows="2" class="input-large"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['meta_description'], ENT_QUOTES, 'UTF-8');
            ?>
</textarea>
                            <?php 
            echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "meta_description", 'name' => "update_all_vendors[meta_description]"), 0);
            ?>

                        </div>
                    </div>

                    <div class="control-group <?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
            ?>
">
                        <label class="control-label" for="elm_product_meta_keywords"><?php 
            echo $_smarty_tpl->__("meta_keywords");
            ?>
:</label>
                        <div class="controls">
                            <textarea name="product_data[meta_keywords]" id="elm_product_meta_keywords" cols="55" rows="2" class="input-large"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['product_data']->value['meta_keywords'], ENT_QUOTES, 'UTF-8');
            ?>
</textarea>
                            <?php 
            echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "meta_keywords", 'name' => "update_all_vendors[meta_keywords]"), 0);
            ?>

                        </div>
                    </div>
                </div>
                <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:update_seo"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

            </div>
            

            
            <div id="content_shippings" class="hidden"> 
                <?php 
        echo $_smarty_tpl->getSubTemplate("views/products/components/products_shipping_settings.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

            </div> 
            

            
            <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:update_qty_discounts"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:update_qty_discounts"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

            <?php 
            echo $_smarty_tpl->getSubTemplate("views/products/components/products_update_qty_discounts.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
            ?>

            <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:update_qty_discounts"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

            
            
            <?php 
        echo $_smarty_tpl->getSubTemplate("views/products/components/products_update_features.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_id' => $_smarty_tpl->tpl_vars['product_data']->value['product_id']), 0);
        ?>

            


            <div id="content_addons">
                <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:detailed_content"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:detailed_content"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

                <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:detailed_content"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

            </div>


            <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:tabs_content"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:tabs_content"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

            <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:tabs_content"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>


            
            <?php 
        $_smarty_tpl->_capture_stack[0][] = array("buttons", null, null);
        ob_start();
        ?>
                <?php 
        echo $_smarty_tpl->getSubTemplate("common/view_tools.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('url' => "products.update?product_id="), 0);
        ?>


                <?php 
        if ($_smarty_tpl->tpl_vars['id']->value) {
            ?>
                    <?php 
            $_smarty_tpl->_capture_stack[0][] = array("tools_list", null, null);
            ob_start();
            ?>
                        <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:update_tools_list"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "products:update_tools_list"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

                            <?php 
                if ($_smarty_tpl->tpl_vars['view_uri']->value) {
                    ?>
                                <li><?php 
                    smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'target' => "_blank", 'text' => __("preview"), 'href' => $_smarty_tpl->tpl_vars['view_uri']->value));
                    ?>
</li>
                                <li class="divider"></li>
                            <?php 
                }
                ?>
                            <li><?php 
                smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("clone"), 'class' => "cm-post", 'href' => "products.clone?product_id=" . (string) $_smarty_tpl->tpl_vars['id']->value));
                ?>
</li>
                            <?php 
                if ($_smarty_tpl->tpl_vars['allow_save']->value) {
                    ?>
                                <li><?php 
                    smarty_template_function_btn($_smarty_tpl, array('type' => "list", 'text' => __("delete"), 'class' => "cm-confirm cm-post", 'href' => "products.delete?product_id=" . (string) $_smarty_tpl->tpl_vars['id']->value));
                    ?>
</li>
                            <?php 
                }
                ?>
                        <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "products:update_tools_list"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

                    <?php 
            list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
            if (!empty($_capture_buffer)) {
                if (isset($_capture_assign)) {
                    $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                }
                if (isset($_capture_append)) {
                    $_smarty_tpl->append($_capture_append, ob_get_contents());
                }
                Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
            } else {
                $_smarty_tpl->capture_error();
            }
            ?>
                    <?php 
            smarty_template_function_dropdown($_smarty_tpl, array('content' => Smarty::$_smarty_vars['capture']['tools_list']));
            ?>

                <?php 
        }
        ?>
                <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/save_cancel.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => "submit-link", 'but_name' => "dispatch[products.update]", 'but_target_form' => "product_update_form", 'save' => $_smarty_tpl->tpl_vars['id']->value), 0);
        ?>

            <?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>
            

        </form> 

        <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:tabs_extra"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:tabs_extra"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:tabs_extra"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>


        <?php 
        if ($_smarty_tpl->tpl_vars['id']->value) {
            ?>
            
            <div class="cm-hide-save-button hidden" id="content_options">
                <?php 
            echo $_smarty_tpl->getSubTemplate("views/products/components/products_update_options.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
            ?>

            </div>
            

            
            <?php 
            if ($_smarty_tpl->tpl_vars['settings']->value['General']['enable_edp'] == "Y") {
                ?>
            <div id="content_files" class="cm-hide-save-button hidden">
                <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:content_files"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "products:content_files"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    ?>

                <?php 
                    echo $_smarty_tpl->getSubTemplate("views/products/components/products_update_files.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
                    ?>

                <?php 
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "products:content_files"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

            </div>
            <?php 
            }
            ?>
            

            
            <div id="content_subscribers" class="cm-hide-save-button hidden">
                <?php 
            echo $_smarty_tpl->getSubTemplate("views/products/components/product_subscribers.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_id' => $_smarty_tpl->tpl_vars['id']->value), 0);
            ?>

            </div>
            
        <?php 
        }
        ?>

    <?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>
    <?php 
        echo $_smarty_tpl->getSubTemplate("common/tabsbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('content' => Smarty::$_smarty_vars['capture']['tabsbox'], 'group_name' => $_smarty_tpl->tpl_vars['runtime']->value['controller'], 'active_tab' => $_REQUEST['selected_section'], 'track' => true), 0);
        ?>


<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>

<?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "products:update_mainbox_params"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "products:update_mainbox_params"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>


<?php 
            if ($_smarty_tpl->tpl_vars['id']->value) {
                ?>
    <?php 
                $_smarty_tpl->_capture_stack[0][] = array("mainbox_title", null, null);
                ob_start();
                ?>
        <?php 
                ob_start();
                echo $_smarty_tpl->__("editing_product");
                $_tmp5 = ob_get_clean();
                echo htmlspecialchars(preg_replace('!<[^>]*?>!', ' ', $_tmp5 . ": " . (string) $_smarty_tpl->tpl_vars['product_data']->value['product']), ENT_QUOTES, 'UTF-8');
                ?>

    <?php 
                list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                if (!empty($_capture_buffer)) {
                    if (isset($_capture_assign)) {
                        $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                    }
                    if (isset($_capture_append)) {
                        $_smarty_tpl->append($_capture_append, ob_get_contents());
                    }
                    Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                } else {
                    $_smarty_tpl->capture_error();
                }
            } else {
                ?>
    <?php 
                $_smarty_tpl->_capture_stack[0][] = array("mainbox_title", null, null);
                ob_start();
                ?>
        <?php 
                echo $_smarty_tpl->__("new_product");
                ?>

    <?php 
                list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                if (!empty($_capture_buffer)) {
                    if (isset($_capture_assign)) {
                        $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                    }
                    if (isset($_capture_append)) {
                        $_smarty_tpl->append($_capture_append, ob_get_contents());
                    }
                    Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                } else {
                    $_smarty_tpl->capture_error();
                }
            }
            ?>

<?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "products:update_mainbox_params"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>


<?php 
        echo $_smarty_tpl->getSubTemplate("common/mainbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => Smarty::$_smarty_vars['capture']['mainbox_title'], 'content' => Smarty::$_smarty_vars['capture']['mainbox'], 'select_languages' => $_smarty_tpl->tpl_vars['id']->value, 'buttons' => Smarty::$_smarty_vars['capture']['buttons'], 'adv_buttons' => Smarty::$_smarty_vars['capture']['adv_buttons']), 0);
    }
コード例 #18
0
        if ($tax['price_includes_tax'] == 'Y') {
            continue;
        }
        $unit_price = fn_format_price($tax['tax_subtotal']);
        $items .= "<SKU>" . htmlspecialchars($tax['description']) . "</SKU>\n            <Description>" . htmlspecialchars($tax['description']) . "</Description>\n            <Quantity>1</Quantity>\n            <UnitPrice>{$unit_price}</UnitPrice>";
    }
}
$payflow_expire = '20' . $order_info['payment_info']['expiry_year'] . $order_info['payment_info']['expiry_month'];
$payflow_order_id = $processor_data['processor_params']['order_prefix'] . $order_id . ($order_info['repaid'] ? "_{$order_info['repaid']}" : '') . '_' . fn_date_format(time(), '%H_%M_%S');
if (!empty($order_info['shipping']) && is_array($order_info['shipping'])) {
    $shipping_name = reset($order_info['shipping']);
} else {
    $shipping_name = array();
    $shipping_name['shipping'] = __('no_shipping_required');
}
$subtotal_discount = floatval($order_info['subtotal_discount']) ? fn_format_price($order_info['subtotal_discount']) : 0;
$post = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<XMLPayRequest Timeout='45' version="2.0">
    <RequestData>
        <Partner>{$payflow_partner}</Partner>
        <Vendor>{$payflow_vendor}</Vendor>
        <Transactions>
            <Transaction>
                <Sale>
                    <PayData>
                        <Invoice>
                            <BillTo>
                                <Name>{$shipping_name['shipping']}</Name>
                                <Address>
                                    <Street>{$order_info['b_address']}</Street>
コード例 #19
0
ファイル: sagepay_direct.php プロジェクト: askzap/ultimate
    }
    if (fn_order_shipping_cost($order_info)) {
        $products_string .= ':Shipping cost:---:---:---:---:' . fn_format_price($order_info['shipping_cost']);
        $strings++;
    }
    if (floatval($order_info['subtotal_discount'])) {
        $desc = __('order_discount');
        $pr = fn_format_price($order_info['subtotal_discount']);
        $products_string .= ":{$desc}:---:---:---:---:-" . fn_format_price($order_info['subtotal_discount']);
        $strings++;
    }
    if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') {
        foreach ($order_info['taxes'] as $tax_id => $tax) {
            if ($tax['price_includes_tax'] == 'N') {
                $desc = $tax['description'];
                $products_string .= ":{$desc}:---:---:---:---:" . fn_format_price($tax['tax_subtotal']);
                $strings++;
            }
        }
    }
    $post['Basket'] = $strings . $products_string;
    $post['ClientIPAddress'] = $_SERVER['REMOTE_ADDR'];
    Registry::set('log_cut_data', array('CardNumber', 'ExpiryDate', 'StartDate', 'CV2'));
    $result = Http::post($post_address, $post);
}
$rarr = explode("\r\n", $result);
$response = array();
foreach ($rarr as $v) {
    if (preg_match('/([^=]+?)=(.+)/', $v, $m)) {
        $response[$m[1]] = trim($m[2]);
    }
コード例 #20
0
ファイル: rma.post.php プロジェクト: askzap/ultimate
     $comment = $_REQUEST['comment'];
     $total_amount = 0;
     foreach ($returns as $k => $v) {
         if (isset($v['chosen']) && $v['chosen'] == 'Y') {
             $total_amount += $v['amount'];
         }
     }
     $_data = array('order_id' => $order_id, 'user_id' => $user_id, 'action' => $action, 'timestamp' => TIME, 'status' => RMA_DEFAULT_STATUS, 'total_amount' => $total_amount, 'comment' => $comment);
     $return_id = db_query('INSERT INTO ?:rma_returns ?e', $_data);
     $order_items = db_get_hash_array("SELECT item_id, order_id, extra, price, amount FROM ?:order_details WHERE order_id = ?i", 'item_id', $order_id);
     foreach ($returns as $item_id => $v) {
         if (isset($v['chosen']) && $v['chosen'] == 'Y') {
             if (true == fn_rma_declined_product_correction($order_id, $k, $v['available_amount'], $v['amount'])) {
                 $_item = $order_items[$item_id];
                 $extra = @unserialize($_item['extra']);
                 $_data = array('return_id' => $return_id, 'item_id' => $item_id, 'product_id' => $v['product_id'], 'reason' => !empty($v['reason']) ? $v['reason'] : '', 'amount' => $v['amount'], 'product_options' => !empty($extra['product_options_value']) ? serialize($extra['product_options_value']) : '', 'price' => fn_format_price((!isset($extra['exclude_from_calculate']) ? $_item['price'] : 0) * $_item['amount'] / $_item['amount']), 'product' => !empty($extra['product']) ? $extra['product'] : fn_get_product_name($v['product_id'], $oder_lang_code));
                 db_query('INSERT INTO ?:rma_return_products ?e', $_data);
                 if (!isset($extra['returns'])) {
                     $extra['returns'] = array();
                 }
                 $extra['returns'][$return_id] = array('amount' => $v['amount'], 'status' => RMA_DEFAULT_STATUS);
                 db_query('UPDATE ?:order_details SET ?u WHERE item_id = ?i AND order_id = ?i', array('extra' => serialize($extra)), $item_id, $order_id);
             }
         }
     }
     //Send mail
     $return_info = fn_get_return_info($return_id);
     $order_info = fn_get_order_info($order_id);
     fn_send_return_mail($return_info, $order_info, array('C' => true, 'A' => true, 'S' => true));
 }
 return array(CONTROLLER_STATUS_OK, 'rma.details?return_id=' . $return_id);
コード例 #21
0
ファイル: func.php プロジェクト: arpad9/bygmarket
function fn_gift_certificates_calculate_cart(&$cart, &$cart_products, &$auth)
{
    $subtotal = 0;
    if (isset($cart['additional_gift_certificates'])) {
        $cart['gift_certificates'] = fn_array_merge(!empty($cart['gift_certificates']) ? $cart['gift_certificates'] : array(), $cart['additional_gift_certificates']);
        unset($cart['additional_gift_certificates']);
    }
    if (!empty($cart['gift_certificates'])) {
        foreach ((array) $cart['gift_certificates'] as $k => $v) {
            $cart['gift_certificates'][$k]['subtotal'] = $v['amount'];
            $cart['gift_certificates'][$k]['display_subtotal'] = $v['amount'];
            $cart['gift_certificates'][$k]['tax_value'] = 0;
            if (!isset($v['extra']['exclude_from_calculate'])) {
                $subtotal += $v['amount'];
            }
            if (!empty($v['products'])) {
                foreach ($cart['products'] as $cart_id => $product) {
                    if (!empty($product['extra']['parent']['certificate']) && $product['extra']['parent']['certificate'] == $k) {
                        $cart['gift_certificates'][$k]['subtotal'] += $cart_products[$cart_id]['subtotal'];
                        $cart['gift_certificates'][$k]['display_subtotal'] += $cart_products[$cart_id]['display_subtotal'];
                        /*if (!empty($cart_products[$cart_id]['tax_summary']['added'])) {
                              $cart['gift_certificates'][$k]['tax_value'] += $cart_products[$cart_id]['tax_summary']['added'];
                          }*/
                    }
                }
                foreach ($v['products'] as $id => $val) {
                    $exists = false;
                    foreach ($cart['products'] as $cart_id => $product) {
                        if ($product['product_id'] == $val['product_id']) {
                            $exists = true;
                            break;
                        }
                    }
                    if (!$exists && empty($cart['parent_order_id'])) {
                        unset($cart['gift_certificates'][$k]['products'][$id]);
                    }
                }
            }
        }
        $cart['amount'] = (isset($cart['amount']) ? $cart['amount'] : 0) + sizeof($cart['gift_certificates']);
        $cart['total'] = (isset($cart['total']) ? $cart['total'] : 0) + $subtotal;
        $cart['subtotal'] += $subtotal;
        $cart['display_subtotal'] += $subtotal;
        $cart['pure_subtotal'] = (isset($cart['pure_subtotal']) ? $cart['pure_subtotal'] : 0) + $subtotal;
    }
    if (!empty($cart['use_gift_certificates'])) {
        $_original = $_subtotal = Registry::get('addons.gift_certificates.redeem_shipping_cost') == 'Y' ? $cart['total'] : $cart['subtotal'];
        foreach ((array) $cart['use_gift_certificates'] as $code => $value) {
            $_subtotal -= $value['amount'];
            if ($_subtotal >= 0) {
                $cart['use_gift_certificates'][$code]['cost'] = $value['amount'];
            } else {
                $cart['use_gift_certificates'][$code]['cost'] = $value['amount'] + $_subtotal;
                $_subtotal = 0;
            }
        }
        $cart['total'] -= $_original - $_subtotal;
        $cart['total'] = fn_format_price($cart['total']);
    }
    // We need to display coupon code field
    $cart['has_coupons'] = true;
}
コード例 #22
0
ファイル: paysitecash.php プロジェクト: askzap/ultimate
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!empty($_REQUEST['etat']) && !empty($_REQUEST['id_trans']) && !empty($_REQUEST['devise_sent']) && !empty($_REQUEST['divers']) && !empty($_REQUEST['ref'])) {
    require './init_payment.php';
    $order_id = intval($_REQUEST['ref']);
    if (fn_check_payment_script('paysitecash.php', $order_id)) {
        //Parse "divers"
        $divers = array();
        parse_str(base64_decode($_REQUEST['divers']), $divers);
        //Params check
        if ($divers['key'] != md5(fn_format_price($_REQUEST['montant_sent'], CART_PRIMARY_CURRENCY, null, false) . Registry::get('config.crypt_key') . $_REQUEST['ref'])) {
            exit('Wrong checksum');
        }
        $etat = $_REQUEST['etat'];
        $id_trans = $_REQUEST['id_trans'];
        $order_id = intval($_REQUEST['ref']);
        $devise = $_REQUEST['devise_sent'];
        $error = !empty($_REQUEST['errordetail']) ? urldecode($_REQUEST['errordetail']) : '';
        if ($devise != CART_PRIMARY_CURRENCY) {
            $etat = 'currency';
        }
        $pp_response = array('transaction_id' => $id_trans);
        if ($etat == 'ok') {
            $pp_response['order_status'] = 'P';
            $pp_response['reason_text'] = 'Transaction accepted';
        } elseif ($etat == 'ko') {
コード例 #23
0
 public final function getOrderSectionsInfo($date_periods, $total_periods, $orders, $sort_by, $sort_order)
 {
     $order_sections = array();
     $section_names = array();
     $order_totals = array();
     $show_empty_sections = false;
     if ($sort_by == 'date') {
         $last_date = min($date_periods);
         foreach (array_keys($date_periods) as $period_id) {
             $section_names[$period_id] = self::getOrderPeriodName($period_id);
         }
         foreach ($orders as $order) {
             $selected_period_id = '';
             if ($order['timestamp'] > TIME) {
                 $selected_period_id = 'future';
             } elseif ($order['timestamp'] < $last_date) {
                 $selected_period_id = 'past';
             } else {
                 foreach ($date_periods as $period_id => $start_date) {
                     if ($order['timestamp'] > $start_date) {
                         $selected_period_id = $period_id;
                         break;
                     }
                 }
             }
             if ($selected_period_id != '') {
                 $order_sections[$selected_period_id][] = $order;
                 $order_totals[$selected_period_id] = isset($order_totals[$selected_period_id]) ? $order_totals[$selected_period_id] + $order['total'] : $order['total'];
             }
         }
         if (isset($order_sections['future'])) {
             $section_names = array('future' => self::getOrderPeriodName('future')) + $section_names;
         }
         if (isset($order_sections['past'])) {
             $section_names['past'] = self::getOrderPeriodName('more_than_year');
         }
         if ($sort_order == 'asc') {
             $section_names = array_reverse($section_names, true);
         }
         $show_empty_sections = true;
     } elseif ($sort_by == 'status') {
         $section_names = fn_get_statuses(STATUSES_ORDER, true);
         ksort($section_names);
         if ($sort_order == 'desc') {
             $section_names = array_reverse($section_names);
         }
         foreach ($orders as $order) {
             $selected_period_id = $order['status'];
             $order_sections[$selected_period_id][] = $order;
             $order_totals[$selected_period_id] = isset($order_totals[$selected_period_id]) ? $order_totals[$selected_period_id] + $order['total'] : $order['total'];
         }
         $show_empty_sections = true;
     } elseif ($sort_by == 'total') {
         $min_total = min($total_periods);
         $section_names = array();
         foreach ($total_periods as $subtotal) {
             $section_names['more_' . $subtotal] = __('more_than') . ' ' . fn_format_price($subtotal);
         }
         $section_names['less'] = __('less_than') . ' ' . fn_format_price($min_total);
         reset($total_periods);
         foreach ($orders as $order) {
             if ($order['total'] < $min_total) {
                 $selected_period_id = 'less';
             } else {
                 foreach ($total_periods as $subtotal) {
                     if ($order['total'] > $subtotal) {
                         $selected_period_id = 'more_' . $subtotal;
                         break;
                     }
                 }
             }
             if ($selected_period_id) {
                 $order_sections[$selected_period_id][] = $order;
                 $order_totals[$selected_period_id] = isset($order_totals[$selected_period_id]) ? $order_totals[$selected_period_id] + $order['total'] : $order['total'];
             }
         }
         if ($sort_order == 'asc') {
             $section_names = array_reverse($section_names);
         }
     }
     return array($order_sections, $section_names, $order_totals, $show_empty_sections);
 }
コード例 #24
0
ファイル: searchanise.php プロジェクト: heg-arc-ne/cscart
function fn_se_prepare_product_data($product_data, $usergroups, $company_id, $lang_code)
{
    $types_map = array('D' => 'int', 'M' => 'text', 'S' => 'text', 'N' => 'float', 'E' => 'text', 'C' => 'text', 'T' => 'text', 'O' => 'float');
    $entry = array('id' => array('value' => $product_data['product_id'], 'title' => __('se_product_id')), 'title' => array('value' => $product_data['product'], 'title' => __('se_title')), 'summary' => array('value' => !empty($product_data['short_description']) ? $product_data['short_description'] : $product_data['full_description'], 'title' => __('se_summary')), 'link' => array('value' => fn_url('products.view?product_id=' . $product_data['product_id'], 'C', 'http', $lang_code), 'title' => __('se_link')), 'price' => array('value' => fn_format_price($product_data['price']), 'title' => __('se_price')), 'quantity' => array('value' => $product_data['amount'], 'title' => __('se_quantity')), 'product_code' => array('value' => $product_data['product_code'], 'title' => __('se_product_code')), 'image_link' => array('title' => __('se_image_link')));
    if (!empty($product_data['main_pair'])) {
        $thumbnail = fn_image_to_display($product_data['main_pair'], SE_IMAGE_SIZE, SE_IMAGE_SIZE);
    }
    if (!empty($thumbnail['image_path'])) {
        $image_link = $thumbnail['image_path'];
    } elseif (!empty($product_data['main_pair']['detailed']['http_image_path'])) {
        $image_link = $product_data['main_pair']['detailed']['http_image_path'];
    } else {
        $image_link = '';
    }
    $entry['image_link']['value'] = htmlspecialchars($image_link);
    if (!empty($product_data['search_words'])) {
        $entry['search_words'] = array('name' => 'search_words', 'title' => __('search_words'), 'text_search' => 'Y', 'weight' => 100, 'value' => $product_data['search_words']);
    }
    if (!empty($product_data['product_features'])) {
        foreach ($product_data['product_features'] as $f) {
            $name = "f_{$f['feature_id']}";
            $entry[$name] = array('name' => $name, 'title' => $f['feature'], 'text_search' => 'Y', 'weight' => 60);
            if ($f['feature_type'] == ProductFeatures::TEXT_SELECTBOX || $f['feature_type'] == ProductFeatures::EXTENDED) {
                $entry[$name]['value'] = $f['variant'];
            } else {
                $entry[$name]['value'] = $f['value'];
            }
        }
    }
    if (!empty($product_data['short_description']) && !empty($product_data['se_full_description'])) {
        $entry['full_description'] = array('name' => 'full_description', 'title' => __('full_description'), 'text_search' => 'Y', 'weight' => 40);
        $entry['full_description']['value'] = $product_data['se_full_description'];
    }
    if (!empty($product_data['product_features']) && fn_se_get_setting('use_navigation', $company_id, DEFAULT_LANGUAGE) == 'Y') {
        foreach ($product_data['product_features'] as $f) {
            if ($f['feature_type'] == ProductFeatures::GROUP) {
                continue;
            }
            $name = "feature_{$f['feature_id']}";
            $entry[$name] = array('name' => $name, 'type' => $types_map[$f['feature_type']], 'title' => str_replace('[id]', $f['feature'], __("se_for_feature_id")));
            if ($f['feature_type'] == ProductFeatures::MULTIPLE_CHECKBOX) {
                if (!empty($f['variants']) && is_array($f['variants'])) {
                    foreach ($f['variants'] as $fv) {
                        $entry[$name]['value'][] = $fv['variant_id'];
                    }
                }
            } else {
                if ($f['feature_type'] == ProductFeatures::TEXT_SELECTBOX || $f['feature_type'] == ProductFeatures::EXTENDED) {
                    $entry[$name]['value'] = $f['variant_id'];
                } elseif ($f['feature_type'] == ProductFeatures::NUMBER_SELECTBOX) {
                    $entry[$name]['value'] = $f['variant'];
                } elseif ($f['feature_type'] == ProductFeatures::NUMBER_FIELD || $f['feature_type'] == ProductFeatures::DATE) {
                    $entry[$name]['value'] = $f['value_int'];
                } elseif ($f['feature_type'] == ProductFeatures::SINGLE_CHECKBOX) {
                    $entry[$name]['value'] = $f['value'] == 'Y' ? 'Y' : 'N';
                } else {
                    // ProductFeatures::TEXT_FIELD
                    $entry[$name]['value'] = $f['value'];
                }
            }
        }
    }
    //
    //
    //
    $entry['category_id'] = array('name' => 'category_id', 'title' => __('se_category_Id'), 'value' => array());
    foreach ($product_data['category_ids'] as $category_id) {
        $entry['category_id']['value'][] = $category_id;
    }
    //
    //
    //
    $entry['category_usergroup_ids'] = array('name' => 'category_usergroup_ids', 'title' => __('se_category_usergroup_ids'), 'value' => array());
    foreach ($product_data['category_usergroup_ids'] as $usergroup_id) {
        $entry['category_usergroup_ids']['value'][] = $usergroup_id;
    }
    //
    //
    //
    $entry['usergroup_ids'] = array('name' => 'usergroup_ids', 'title' => __('se_usergroup_ids'), 'value' => array());
    $product_data['usergroup_ids'] = empty($product_data['usergroup_ids']) ? array(0) : explode(',', $product_data['usergroup_ids']);
    foreach ($product_data['usergroup_ids'] as $usergroup_id) {
        $entry['usergroup_ids']['value'][] = $usergroup_id;
    }
    //
    //
    //
    foreach ($usergroups as $usergroup) {
        $usergroup_id = $usergroup['usergroup_id'];
        $price = !empty($product_data['se_prices'][$usergroup_id]['price']) ? $product_data['se_prices'][$usergroup_id]['price'] : $product_data['se_prices'][0]['price'];
        $name = 'price_' . intval($usergroup_id);
        $entry[$name] = array('name' => $name, 'title' => str_replace('[id]', $usergroup_id, __("se_price_for_usergroup_id")), 'type' => 'float', 'value' => $price);
    }
    //
    //
    //
    $additional_attrs = array('company_id' => 'text', 'weight' => 'float', 'popularity' => 'float', 'amount' => 'int', 'timestamp' => 'int', 'position' => 'int', 'free_shipping' => 'text', 'empty_categories' => 'text', 'status' => 'text');
    if (!empty($product_data['sales_amount'])) {
        $additional_attrs['sales_amount'] = 'int';
    }
    foreach ($additional_attrs as $name => $type) {
        if ($name == 'company_id') {
            $title = __('se_company_id');
        } elseif ($name == 'empty_categories') {
            $title = __('se_empty_categories');
        } else {
            $title = __($name);
        }
        $entry[$name] = array('name' => $name, 'title' => $title, 'type' => $type, 'value' => isset($product_data[$name]) ? $product_data[$name] : '');
    }
    return $entry;
}
コード例 #25
0
ファイル: rma.post.php プロジェクト: askzap/ultimate
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    //
    // Creation gift certificate
    //
    if ($mode == 'create_gift_certificate') {
        $change_return_status = $_REQUEST['change_return_status'];
        if (!empty($_REQUEST['accepted'])) {
            $total = 0;
            $return_info = fn_get_return_info($change_return_status['return_id']);
            foreach ((array) $_REQUEST['accepted'] as $item_id => $v) {
                if (isset($v['chosen']) && $v['chosen'] == 'Y') {
                    $total += $v['amount'] * $return_info['items'][RETURN_PRODUCT_ACCEPTED][$item_id]['price'];
                }
            }
            if ($total > 0) {
                $certificate = fn_create_return_gift_certificate($return_info['order_id'], fn_format_price($total));
                $return_info['extra'] = unserialize($return_info['extra']);
                if (!isset($return_info['extra']['gift_certificates'])) {
                    $return_info['extra']['gift_certificates'] = array();
                }
                $return_info['extra']['gift_certificates'] = fn_array_merge($return_info['extra']['gift_certificates'], $certificate);
                $_data = array('extra' => serialize($return_info['extra']));
                db_query("UPDATE ?:rma_returns SET ?u WHERE return_id = ?i", $_data, $change_return_status['return_id']);
            }
        }
        return array(CONTROLLER_STATUS_REDIRECT, 'rma.details?return_id=' . $change_return_status['return_id']);
    }
}
コード例 #26
0
ファイル: func.php プロジェクト: ambient-lounge/site
function fn_set_point_payment(&$cart, &$cart_products, &$auth)
{
    $user_info = Registry::get('user_info');
    // pick previously applied points before update
    $cost_covered_by_applied_points = !empty($cart['points_info']['in_use']['cost']) ? $cart['points_info']['in_use']['cost'] : 0;
    $point_exchange_rate = floatval(Registry::get('addons.reward_points.point_rate'));
    if (defined('ORDER_MANAGEMENT')) {
        $user_points = fn_get_user_additional_data(POINTS, $auth['user_id']) + (!empty($cart['previous_points_info']['in_use']['points']) ? $cart['previous_points_info']['in_use']['points'] : 0);
    } else {
        $user_points = !empty($user_info) ? $user_info['points'] : 0;
    }
    if ($point_exchange_rate * $user_points * floatval($cart['subtotal']) > 0) {
        $points_in_use = $cart['points_info']['in_use']['points'];
        if ($points_in_use > $user_points) {
            $points_in_use = $user_points;
            fn_set_notification('W', __('warning'), __('text_points_exceed_points_on_account'));
        }
        if (empty($cart['points_info']['total_price'])) {
            $cart['points_info']['total_price'] = 0;
        }
        if ($points_in_use > $cart['points_info']['total_price']) {
            $points_in_use = $cart['points_info']['total_price'];
            fn_set_notification('W', __('warning'), __('text_points_exceed_points_that_can_be_applied'));
        }
        if (!empty($points_in_use)) {
            $cost = 0;
            $subtotal_discount_coef = !empty($cart['subtotal_discount']) ? 1 - ($cart['subtotal_discount'] - $cost_covered_by_applied_points) / $cart['subtotal'] : 1;
            foreach ($cart['products'] as $cart_id => $v) {
                if (isset($v['extra']['points_info']['price'])) {
                    $all_points = $points_in_use == $cart['points_info']['total_price'] ? $cart['points_info']['total_price'] : $cart['points_info']['raw_total_price'];
                    $discount = $points_in_use / $all_points * $cart_products[$cart_id]['subtotal'] * $subtotal_discount_coef;
                    $cart['products'][$cart_id]['extra']['points_info']['discount'] = fn_format_price($discount);
                    $cost += $discount;
                }
            }
            // check for subtotal discounts
            $subtotal_odds = $cart['subtotal'] - $cost - (!empty($cart['subtotal_discount']) ? $cart['subtotal_discount'] - $cost_covered_by_applied_points : 0);
            // check for totals discounts, certificates and etc.
            $total_odds = floatval($cart['subtotal']) - $cost;
            $odds = min($subtotal_odds, $total_odds);
            if (fn_format_price($odds) < 0) {
                $points_in_use = ceil($points_in_use * ($cost + $odds) / $cost);
                $cost += $odds;
            }
            if ($points_in_use == floor($cart['points_info']['raw_total_price'])) {
                $points_in_use = (int) ($cart['points_info']['raw_total_price'] * 100 / 100);
            }
            if (fn_format_price($cost) && $cost > 0) {
                $cost = fn_format_price($cost);
                $cart['points_info']['in_use'] = array('points' => $points_in_use, 'cost' => $cost);
                if (!empty($cost_covered_by_applied_points)) {
                    // avoid repeated discount applying
                    $cost -= $cost_covered_by_applied_points;
                }
                if (!empty($cost)) {
                    $cart['subtotal_discount'] += $cost;
                    $cart['subtotal_discount'] = $cart['subtotal_discount'] > 0 ? $cart['subtotal_discount'] : 0;
                    $cart['subtotal_discount'] = fn_format_price($cart['subtotal_discount']);
                }
            } else {
                fn_set_notification('E', __('error'), __('text_points_cannot_applied_because_subtotal_redeemed'));
                unset($cart['points_info']['in_use']);
            }
        } else {
            unset($cart['points_info']['in_use']);
        }
    } else {
        if (floatval($cart['subtotal']) == 0) {
            fn_set_notification('E', __('error'), __('text_cannot_apply_points_to_this_order_because_total'));
        }
        if ($user_points <= 0) {
            fn_set_notification('E', __('error'), __('text_cannot_apply_points_to_this_order_because_user'));
        }
        unset($cart['points_info']['in_use']);
    }
    Registry::set('user_info', $user_info);
}
コード例 #27
0
ファイル: direct_one.php プロジェクト: ambient-lounge/site
                $post_data[$item_name] = "1,{$item_price}";
            }
        }
        // Gift Certificates
        if (!empty($order_info['gift_certificates'])) {
            foreach ($order_info['gift_certificates'] as $k => $v) {
                $v['gift_cert_code'] = htmlspecialchars($v['gift_cert_code']);
                $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : fn_format_price($v['amount']);
                $post_data[$v['gift_cert_code']] = "1,{$v['amount']}";
            }
        }
        // Payment surcharge
        if (floatval($order_info['payment_surcharge'])) {
            $name = __('surcharge');
            $payment_surcharge_amount = fn_format_price($order_info['payment_surcharge']);
            $post_data[$name] = "1,{$payment_surcharge_amount}";
        }
        // Shipping
        $_shipping_cost = fn_order_shipping_cost($order_info);
        if (floatval($_shipping_cost)) {
            $name = __('shipping_cost');
            $payment_shipping_cost = fn_format_price($_shipping_cost);
            $post_data[$name] = "1,{$payment_shipping_cost}";
        }
    } else {
        $total_description = __('total_product_cost');
        $post_data[$total_description] = "1,{$order_info['total']}";
    }
    fn_create_payment_form($submit_url, $post_data, 'DirectOne server', false);
    exit;
}
コード例 #28
0
ファイル: fn.promotions.php プロジェクト: askzap/ultimate
/**
 * Calculate order discount for sub orders (used in MVE)
 *
 * @param string $type discount type
 * @param array $bonus Array with promotion data
 * @param int $bonus_id Bonus ID
 * @param array $cart Array with cart data
 * @return float calculated discount value
 */
function fn_promotions_calculate_order_discount($bonus, $bonus_id, $cart)
{
    $type = $bonus['discount_bonus'];
    $price = $cart['subtotal'];
    $value = $bonus['discount_value'];
    static $parent_orders = array();
    // this calculations are actual only for the fixed (absolute) amount
    if ($type == 'to_fixed' || $type == 'by_fixed') {
        // if it is parent or usual order
        if (empty($cart['parent_order_id'])) {
            // calculate usual discount
            $discount = fn_promotions_calculate_discount($type, $price, $value);
            // save order discount for future calculations of suborders
            $discount = fn_format_price($discount);
            $session_orders_discount =& $_SESSION['orders_discount'][$bonus['promotion_id'] . '_' . $bonus_id];
            $session_orders_discount['parent_order_discount'] = $discount;
            $session_orders_discount['suborders_discount'] = 0;
        } else {
            // this is sub order
            $parent_order_id = $cart['parent_order_id'];
            // get parent order subtotal info
            if (!isset($parent_orders[$parent_order_id]['subtotal'])) {
                $parent_order_info = fn_get_order_info($parent_order_id);
                $parent_orders[$parent_order_id]['subtotal'] = $parent_order_info['subtotal'];
            }
            if (!empty($parent_orders[$parent_order_id]['subtotal'])) {
                // calculate the share of the full discount
                $value = $value * $price / $parent_orders[$parent_order_id]['subtotal'];
            }
            $discount = fn_promotions_calculate_discount($type, $price, $value);
            $discount = fn_format_price($discount);
            $session_orders_discount =& $_SESSION['orders_discount'][$bonus['promotion_id'] . '_' . $bonus_id];
            $parent_order_discount = !empty($session_orders_discount['parent_order_discount']) ? $session_orders_discount['parent_order_discount'] : 0;
            $suborders_discount = !empty($session_orders_discount['suborders_discount']) ? $session_orders_discount['suborders_discount'] : 0;
            // check that total suborders discount is less than parent_order_discount
            // or this is last sub order, so we have to distract discount, to avoid the extra cents
            $new_suborders_discount = $suborders_discount + $discount;
            if ($new_suborders_discount > $parent_order_discount || !empty($cart['companies']) && end($cart['companies']) == $cart['company_id']) {
                $discount = $parent_order_discount - (!empty($session_orders_discount['suborders_discount']) ? $session_orders_discount['suborders_discount'] : 0);
                if ($discount < 0) {
                    $discount = 0;
                }
            }
            $session_orders_discount['suborders_discount'] = $suborders_discount + $discount;
        }
    } else {
        $discount = fn_promotions_calculate_discount($type, $price, $value);
    }
    return $discount;
}
コード例 #29
0
    foreach ($amazon_products as $key => $product) {
        $sku = empty($product['product_code']) ? 'pid_' . $product['product_id'] : substr(strip_tags($product['product_code']), 0, 250);
        if ($tax_calculation_type == 'amazon' && isset($_taxed_products[$key])) {
            $tax_table_id = 'tax_' . $_taxed_products[$key];
        } else {
            $tax_table_id = 'tax_default';
        }
        $item = array('CallbackOrderItemId' => $sku, 'TaxTableId' => $tax_table_id, 'ShippingMethodIds' => $items_shipping);
        $callback_response['Response']['CallbackOrders']['CallbackOrder']['CallbackOrderItems']['CallbackOrderItem'][] = $item;
    }
    $callback_response['CartPromotionId'] = 'cart-discount';
    // Update the tax info
    if ($tax_calculation_type == 'default' && $tax_subtotal > 0) {
        $tax = array('SKU' => 'taxes', 'MerchantId' => $processor_data['processor_params']['merchant_id'], 'Title' => substr($tax_description, 0, 250), 'Price' => array('Amount' => fn_format_price($tax_subtotal), 'CurrencyCode' => $processor_data['processor_params']['currency']), 'Quantity' => 1, 'UpdateType' => 'REMOVE');
        $callback_response['Response']['CallbackOrders']['CallbackOrder']['UpdatedCartItems']['UpdatedCartItem'][] = $tax;
        $tax = array('SKU' => 'taxes', 'MerchantId' => $processor_data['processor_params']['merchant_id'], 'Title' => __('taxes') . ': ' . substr($tax_description, 0, 240), 'Price' => array('Amount' => fn_format_price($tax_subtotal), 'CurrencyCode' => $processor_data['processor_params']['currency']), 'Quantity' => 1, 'ShippingMethodIds' => $items_shipping, 'UpdateType' => 'ADD');
        $callback_response['Response']['CallbackOrders']['CallbackOrder']['UpdatedCartItems']['UpdatedCartItem'][] = $tax;
    }
    // Generate the full XML response
    $callback_response = '<?xml version="1.0" encoding="UTF-8"?>' . '<OrderCalculationsResponse xmlns="http://payments.amazon.com/checkout/2009-05-15/">' . fn_array_to_xml($callback_response) . '</OrderCalculationsResponse>';
    $_return = 'order-calculations-response=' . urlencode($callback_response);
    if ($processor_data['processor_params']['aws_access_public_key']) {
        $sign = urlencode(fn_amazon_calculate_signature($callback_response, $processor_data['processor_params']['aws_secret_access_key']));
        $aws_access_key = urlencode($processor_data['processor_params']['aws_access_public_key']);
        $_return .= '&Signature=' . $sign;
        $_return .= '&aws-access-key-id=' . $aws_access_key;
    }
    echo $_return;
    exit;
} elseif ($message_recognizer == 'NewOrderNotification') {
    // Order was placed by Amazon checkout. We need to proceed the callback.
コード例 #30
0
    <input type="hidden" name="ship_country" value="{$order_info['s_country']}" />
    <input type="hidden" name="fixed" value="Y" />
    <input type="hidden" name="id_type" value="1" />
    <input type="hidden" name="sh_cost" value="{$sh_cost}" />
    <input type="hidden" name="demo" value="{$is_test}" />
    <input type="hidden" name="dispatch" value="payment_notification" />
    <input type="hidden" name="payment" value="2checkout" />
    <input type="hidden" name="order_id" value="{$order_id}" />
EOT;
    // Products
    $it = 0;
    if (!empty($order_info['products'])) {
        foreach ($order_info['products'] as $k => $v) {
            $it++;
            $is_tangible = !empty($v['extra']['is_edp']) && $v['extra']['is_edp'] == 'Y' ? 'N' : 'Y';
            $price = fn_format_price($v['price'] - fn_external_discounts($v) / $v['amount']);
            $suffix = "_{$it}";
            echo <<<EOT
    <input type="hidden" name="c_prod{$suffix}" value="{$v['product_id']},{$v['amount']}" />
    <input type="hidden" name="c_name{$suffix}" value="{$v['product']}" />
    <input type="hidden" name="c_description{$suffix}" value="{$v['product']}" />
    <input type="hidden" name="c_price{$suffix}" value="{$price}" />
    <input type="hidden" name="c_tangible{$suffix}" value="{$is_tangible}" />
EOT;
        }
    }
    // Certificates
    if (!empty($order_info['gift_certificates'])) {
        foreach ($order_info['gift_certificates'] as $k => $v) {
            $it++;
            $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];