本文整理汇总了PHP中tep_get_tax_rate函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_get_tax_rate函数的具体用法?PHP tep_get_tax_rate怎么用?PHP tep_get_tax_rate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_get_tax_rate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchProduct
/**
* Fetches the product and adds it as an article to the klarna class. No need to return any data.
* Articles need to be set for fraud purpose, incorrect article means no_risk invoice. Hereby klarna will not take any risks.
*
* @param mixed $mProductId The product identified. Either int or string. Adapted according shop functionality
* @param Klarna $oKlarna The Klarna class object. Used to set any articles
* @return void
*/
protected function fetchProduct($mProductId)
{
global $currencies, $currency;
include DIR_WS_CLASSES . 'language.php';
$lng = new language();
if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
$lng->set_language($HTTP_GET_VARS['language']);
} else {
$lng->get_browser_language();
}
$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $mProductId . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
$aProduct_info = tep_db_fetch_array($product_info_query);
$sArtNo = MODULE_PAYMENT_KLARNA_ARTNO == 'id' || MODULE_PAYMENT_KLARNA_ARTNO == '' ? $aProduct_info['id'] : $aProduct_info['name'];
$iTax = tep_get_tax_rate($aProduct_info['products_tax_class_id']);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$iPrice_with_tax = $currencies->get_value($currency) * $aProduct_info['products_price'];
} else {
$iPrice_with_tax = $currencies->get_value($currency) * $aProduct_info['products_price'] * ($iTax / 100 + 1);
}
// Add goods
$this->oKlarna->addArticle(1, $sArtNo, $aProduct_info['products_name'], $iPrice_with_tax, $iTax, 0, KlarnaFlags::INC_VAT);
$this->iSum += $iPrice_with_tax;
}
示例2: product
/**
* @author Michael Hammelmann <michael.hammelmann@flinkux.de>
* @version 1
* @param $pID products_id
**/
function product($pID)
{
global $languages_id;
$product_info_query = tep_db_query("select p.products_distributor_id,p.products_id, pd.products_name, pd.products_description,pd.short_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id,p.products_weight from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $pID . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
$this->price = $product_info['products_price'];
$this->tax = tep_get_tax_rate($product_info['products_tax_class_id']);
$tax_class_query = tep_db_query("select tax_class_title from " . TABLE_TAX_CLASS . " where tax_class_id=" . $product_info['products_tax_class_id']);
$tax_class = tep_db_fetch_array($tax_class_query);
$this->tax_title = $tax_class['tax_class_title'];
$this->weight = $product_info['products_weight'];
$this->short_description = $product_info['short_description'];
$this->name = $product_info['products_name'];
$this->image = $product_info['products_image'];
/**
* added for distributor specific data
**/
$distributor_path_query = tep_db_query("select * from " . TABLE_DISTRIBUTORS . " where distributor_id=" . $product_info['products_distributor_id']);
$distributor_path = tep_db_fetch_array($distributor_path_query);
$this->pdf_path = $distributor_path['pdf_prefix'];
$this->image_path = $distributor_path['image_prefix'];
if ($this->image_path == '') {
$this->image_path = DIR_WS_IMAGES;
}
if ($this->image == '') {
$this->image = 'empty.jpg';
$this->image_path = DIR_WS_IMAGES;
}
}
示例3: quote
function quote($method = '')
{
global $order, $cart, $shipping_weight, $shipping_num_boxes;
if (MODULE_SHIPPING_TABLE4_MODE == 'price') {
$order_total = $cart->show_total();
} else {
$order_total = $shipping_weight;
}
$table4_cost = preg_split("/[:,]/", MODULE_SHIPPING_TABLE4_COST);
$size = sizeof($table4_cost);
for ($i = 0, $n = $size; $i < $n; $i += 2) {
if ($order_total <= $table4_cost[$i]) {
$shipping = $table4_cost[$i + 1];
break;
}
}
if (MODULE_SHIPPING_TABLE4_MODE == 'weight') {
$shipping = $shipping * $shipping_num_boxes;
}
$this->quotes = array('id' => $this->code, 'module' => Translate('table4 titel'), 'methods' => array(array('id' => $this->code, 'title' => Translate('table4 omschrijving'), 'cost' => $shipping + MODULE_SHIPPING_TABLE4_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) {
$this->quotes['icon'] = tep_image($this->icon, $this->title);
}
return $this->quotes;
}
示例4: execute
function execute()
{
global $currencies, $oscTemplate;
if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
$random_product['products_name'] = tep_get_products_name($random_product['products_id']);
$random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);
if (tep_not_null($random_product['specials_new_products_price'])) {
$whats_new_price = '<del>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</del><br />';
$whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
$whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}
if ($this->group == 'boxes_footer') {
$data = '<div class="col-sm-3 col-lg-2">' . ' <div class="footerbox best-sellers">' . ' <h2><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' . MODULE_BOXES_WHATS_NEW_BOX_TITLE . '</a></h2>';
} else {
$data = '<div class="panel panel-default">' . ' <div class="panel-heading"><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' . MODULE_BOXES_WHATS_NEW_BOX_TITLE . '</a></div>';
}
$data .= ' <div class="panel-body text-center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br />' . $whats_new_price . '</div>';
$data .= '</div>';
if ($this->group == 'boxes_footer') {
$data .= '</div>';
}
$oscTemplate->addBlock($data, $this->group);
}
}
示例5: process
function process()
{
global $order, $currencies;
if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ($order->delivery['country_id'] != STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
default:
$pass = false;
break;
}
if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
$tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$tax_description = tep_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$order->info['tax_groups']["{$tax_description}"] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
}
}
}
示例6: quote
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes;
if (MODULE_SHIPPING_TABLE_MODE == 'price') {
$order_total = $this->getShippableTotal();
} else {
$order_total = $shipping_weight;
}
$table_cost = split("[:,]", MODULE_SHIPPING_TABLE_COST);
$size = sizeof($table_cost);
for ($i = 0, $n = $size; $i < $n; $i += 2) {
if ($order_total <= $table_cost[$i]) {
$shipping = $table_cost[$i + 1];
break;
}
}
if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
$shipping = $shipping * $shipping_num_boxes;
}
$this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) {
$this->quotes['icon'] = tep_image($this->icon, $this->title);
}
return $this->quotes;
}
示例7: get_order_total
function get_order_total()
{
global $order, $cart;
$order_total = $order->info['total'];
// Check if gift voucher is in cart and adjust total
$products = $cart->get_products();
for ($i = 0; $i < sizeof($products); $i++) {
$t_prid = tep_get_prid($products[$i]['id']);
$gv_query = tep_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
$gv_result = tep_db_fetch_array($gv_query);
if (ereg('^GIFT', addslashes($gv_result['products_model']))) {
$qty = $cart->get_quantity($t_prid);
$products_tax = tep_get_tax_rate($gv_result['products_tax_class_id']);
if ($this->include_tax == 'false') {
$gv_amount = $gv_result['products_price'] * $qty;
} else {
$gv_amount = ($gv_result['products_price'] + tep_calculate_tax($gv_result['products_price'], $products_tax)) * $qty;
}
$order_total = $order_total - $gv_amount;
}
}
if ($this->include_tax == 'false') {
$order_total = $order_total - $order->info['tax'];
}
if ($this->include_shipping == 'false') {
$order_total = $order_total - $order->info['shipping_cost'];
}
return $order_total;
}
示例8: process
function process()
{
global $order, $currencies;
if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
$pass = false;
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ($order->delivery['country_id'] != STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
default:
$pass = false;
break;
}
if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
$order->info['shipping_method'] = OSCOM::getDef('free_shipping_title');
$order->info['total'] -= $order->info['shipping_cost'];
$order->info['shipping_cost'] = 0;
}
}
if (strpos($_SESSION['shipping']['id'], '\\') !== false) {
list($vendor, $app, $module) = explode('\\', $_SESSION['shipping']['id']);
list($module, $method) = explode('_', $module);
$module = $vendor . '\\' . $app . '\\' . $module;
$code = 'Shipping_' . str_replace('\\', '_', $module);
if (Registry::exists($code)) {
$OSCOM_SM = Registry::get($code);
}
} else {
list($module, $method) = explode('_', $_SESSION['shipping']['id']);
if (is_object($GLOBALS[$module])) {
$OSCOM_SM = $GLOBALS[$module];
}
}
if (tep_not_null($order->info['shipping_method'])) {
if ($OSCOM_SM->tax_class > 0) {
$shipping_tax = tep_get_tax_rate($OSCOM_SM->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$shipping_tax_description = tep_get_tax_description($OSCOM_SM->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
$order->info['tax_groups']["{$shipping_tax_description}"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
$order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
}
}
$this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['shipping_cost']);
}
}
示例9: execute
function execute()
{
global $HTTP_GET_VARS, $languages_id, $currencies, $oscTemplate;
if (!isset($HTTP_GET_VARS['products_id'])) {
if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int) $languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
$data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_SPECIALS) . '">' . MODULE_BOXES_SPECIALS_BOX_TITLE . '</a></div>' . ' <div class="ui-widget-content infoBoxContents" style="text-align: center;"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br /><del>' . $currencies->display_price_normal($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</del><br /><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span></div>' . '</div>';
$oscTemplate->addBlock($data, $this->group);
}
}
}
示例10: execute
function execute()
{
global $HTTP_GET_VARS, $languages_id, $currencies, $oscTemplate;
if (!isset($HTTP_GET_VARS['products_id'])) {
if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int) $languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
$data = '<div class="module specials-box">' . ' <h3 class="module-heading"><a href="' . tep_href_link(FILENAME_SPECIALS) . '">' . MODULE_BOXES_SPECIALS_BOX_TITLE . '</a></h3>' . ' <ul class="module-content boxproduct">' . ' <li class="clearfix">' . ' <a class="boxproduct-img" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '', '') . '</a>' . ' <div class="boxproduct-info">' . ' <a class="product-name boxproduct-name" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a>' . ' <div class="price-box">' . ' <span class="new-price price">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>' . ' <del class="old-price price">' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</del>' . ' </div>' . ' </div>' . ' </li>' . ' </ul>' . '</div>';
$oscTemplate->addBlock($data, $this->group);
}
}
}
示例11: quote
function quote($method = '')
{
global $order;
$this->quotes = array('id' => $this->code, 'module' => OSCOM::getDef('module_shipping_flat_text_title'), 'methods' => array(array('id' => $this->code, 'title' => OSCOM::getDef('module_shipping_flat_text_way'), 'cost' => MODULE_SHIPPING_FLAT_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) {
$this->quotes['icon'] = HTML::image($this->icon, $this->title);
}
return $this->quotes;
}
示例12: process
function process()
{
global $order, $currencies;
if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ($order->delivery['country_id'] != STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
default:
$pass = false;
break;
}
/* One Page Checkout - BEGIN */
/* if ( ($pass == true) && ( ($order->info['subtotal'] - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
$order->info['shipping_method'] = FREE_SHIPPING_TITLE;
$order->info['total'] -= $order->info['shipping_cost'];
$order->info['shipping_cost'] = 0;
}
*/
if (ONEPAGE_CHECKOUT_ENABLED != 'True') {
if ($pass == true && $order->info['subtotal'] - $order->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
$order->info['shipping_method'] = FREE_SHIPPING_TITLE;
$order->info['total'] -= $order->info['shipping_cost'];
$order->info['shipping_cost'] = 0;
}
}
/* One Page Checkout - END */
}
$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
if (tep_not_null($order->info['shipping_method'])) {
if ($GLOBALS[$module]->tax_class > 0) {
$shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
$order->info['tax_groups']["{$shipping_tax_description}"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
$order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
}
}
$this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['shipping_cost']);
}
}
示例13: quote
function quote($method = '')
{
global $order;
$this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY, 'cost' => MODULE_SHIPPING_FLAT_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) {
$this->quotes['icon'] = tep_image($this->icon, $this->title);
}
return $this->quotes;
}
示例14: execute
function execute()
{
global $PHP_SELF, $oscTemplate, $currencies;
$OSCOM_Db = Registry::get('Db');
if ($PHP_SELF == 'product_info.php' && isset($_GET['products_id'])) {
$Qproduct = $OSCOM_Db->prepare('select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_quantity, p.products_tax_class_id, p.products_date_available from :table_products p, :table_products_description pd where p.products_id = :products_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id');
$Qproduct->bindInt(':products_id', $_GET['products_id']);
$Qproduct->bindInt(':language_id', $_SESSION['languages_id']);
$Qproduct->execute();
if ($Qproduct->fetch() !== false) {
$data = array('card' => 'product', 'title' => $Qproduct->value('products_name'));
if (tep_not_null(MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_SITE_ID)) {
$data['site'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_SITE_ID;
}
if (tep_not_null(MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_USER_ID)) {
$data['creator'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_USER_ID;
}
$product_description = substr(trim(preg_replace('/\\s\\s+/', ' ', strip_tags($Qproduct->value('products_description')))), 0, 197);
if (strlen($product_description) == 197) {
$product_description .= ' ..';
}
$data['description'] = $product_description;
$products_image = $Qproduct->value('products_image');
$Qimage = $OSCOM_Db->get('products_images', 'image', ['products_id' => $Qproduct->valueInt('products_id')], 'sort_order', 1);
if ($Qimage->fetch() !== false) {
$products_image = $Qimage->value('image');
}
$data['image:src'] = OSCOM::link(DIR_WS_IMAGES . $products_image, '', 'NONSSL', false, false);
if ($new_price = tep_get_products_special_price($Qproduct->valueInt('products_id'))) {
$products_price = $currencies->display_price($new_price, tep_get_tax_rate($Qproduct->valueInt('products_tax_class_id')));
} else {
$products_price = $currencies->display_price($Qproduct->value('products_price'), tep_get_tax_rate($Qproduct->valueInt('products_tax_class_id')));
}
$data['data1'] = $products_price;
$data['label1'] = $_SESSION['currency'];
if ($Qproduct->value('products_date_available') > date('Y-m-d H:i:s')) {
$data['data2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_PRE_ORDER;
$data['label2'] = tep_date_short($Qproduct->value('products_date_available'));
} elseif ($Qproduct->valueInt('products_quantity') > 0) {
$data['data2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_IN_STOCK;
$data['label2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_BUY_NOW;
} else {
$data['data2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_OUT_OF_STOCK;
$data['label2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_CONTACT_US;
}
$result = '';
foreach ($data as $key => $value) {
$result .= '<meta name="twitter:' . tep_output_string_protected($key) . '" content="' . tep_output_string_protected($value) . '" />' . "\n";
}
$oscTemplate->addBlock($result, $this->group);
}
}
}
示例15: execute
function execute()
{
global $PHP_SELF, $HTTP_GET_VARS, $oscTemplate, $languages_id, $currencies, $currency, $product_check;
if ($PHP_SELF == FILENAME_PRODUCT_INFO && isset($HTTP_GET_VARS['products_id'])) {
if ($product_check['total'] > 0) {
$product_info_query = tep_db_query("select p.products_id, COALESCE(NULLIF(pd.products_seo_title, ''), pd.products_name) as products_name, pd.products_description, p.products_image, p.products_price, p.products_quantity, p.products_tax_class_id, p.products_date_available from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "'");
if (tep_db_num_rows($product_info_query) === 1) {
$product_info = tep_db_fetch_array($product_info_query);
$data = array('card' => 'product', 'title' => $product_info['products_name']);
if (tep_not_null(MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_SITE_ID)) {
$data['site'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_SITE_ID;
}
if (tep_not_null(MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_USER_ID)) {
$data['creator'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_USER_ID;
}
$product_description = substr(trim(preg_replace('/\\s\\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197);
if (strlen($product_description) == 197) {
$product_description .= ' ..';
}
$data['description'] = $product_description;
$products_image = $product_info['products_image'];
$pi_query = tep_db_query("select image from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int) $product_info['products_id'] . "' order by sort_order limit 1");
if (tep_db_num_rows($pi_query) === 1) {
$pi = tep_db_fetch_array($pi_query);
$products_image = $pi['image'];
}
$data['image:src'] = tep_href_link(DIR_WS_IMAGES . $products_image, '', 'NONSSL', false, false);
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
$products_price = $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
} else {
$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
$data['data1'] = $products_price;
$data['label1'] = $currency;
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
$data['data2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_PRE_ORDER;
$data['label2'] = tep_date_short($product_info['products_date_available']);
} elseif ($product_info['products_quantity'] > 0) {
$data['data2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_IN_STOCK;
$data['label2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_BUY_NOW;
} else {
$data['data2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_OUT_OF_STOCK;
$data['label2'] = MODULE_HEADER_TAGS_TWITTER_PRODUCT_CARD_TEXT_CONTACT_US;
}
$result = '';
foreach ($data as $key => $value) {
$result .= '<meta name="twitter:' . tep_output_string_protected($key) . '" content="' . tep_output_string_protected($value) . '" />' . "\n";
}
$oscTemplate->addBlock($result, $this->group);
}
}
}
}