Пример #1
0
 function cart()
 {
     global $HTTP_POST_VARS, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment, $comments, $customer_default_address_id;
     $this->content_type = $cart->get_content_type();
     if ($this->content_type != 'virtual' && $sendto == false) {
         $sendto = $customer_default_address_id;
     }
     $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int) $customer_id . "' and ab.customers_id = '" . (int) $customer_id . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = tep_db_fetch_array($customer_address_query);
     if (is_array($sendto) && !empty($sendto)) {
         $shipping_address = array('entry_firstname' => $sendto['firstname'], 'entry_lastname' => $sendto['lastname'], 'entry_company' => $sendto['company'], 'entry_street_address' => $sendto['street_address'], 'entry_suburb' => $sendto['suburb'], 'entry_postcode' => $sendto['postcode'], 'entry_city' => $sendto['city'], 'entry_zone_id' => $sendto['zone_id'], 'zone_name' => $sendto['zone_name'], 'entry_country_id' => $sendto['country_id'], 'countries_id' => $sendto['country_id'], 'countries_name' => $sendto['country_name'], 'countries_iso_code_2' => $sendto['country_iso_code_2'], 'countries_iso_code_3' => $sendto['country_iso_code_3'], 'address_format_id' => $sendto['address_format_id'], 'entry_state' => $sendto['zone_name']);
     } elseif (is_numeric($sendto)) {
         $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $sendto . "'");
         $shipping_address = tep_db_fetch_array($shipping_address_query);
     } else {
         $shipping_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     }
     if (is_array($billto) && !empty($billto)) {
         $billing_address = array('entry_firstname' => $billto['firstname'], 'entry_lastname' => $billto['lastname'], 'entry_company' => $billto['company'], 'entry_street_address' => $billto['street_address'], 'entry_suburb' => $billto['suburb'], 'entry_postcode' => $billto['postcode'], 'entry_city' => $billto['city'], 'entry_zone_id' => $billto['zone_id'], 'zone_name' => $billto['zone_name'], 'entry_country_id' => $billto['country_id'], 'countries_id' => $billto['country_id'], 'countries_name' => $billto['country_name'], 'countries_iso_code_2' => $billto['country_iso_code_2'], 'countries_iso_code_3' => $billto['country_iso_code_3'], 'address_format_id' => $billto['address_format_id'], 'entry_state' => $billto['zone_name']);
     } else {
         $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $billto . "'");
         $billing_address = tep_db_fetch_array($billing_address_query);
     }
     if ($this->content_type == 'virtual') {
         $tax_address = array('entry_country_id' => $billing_address['entry_country_id'], 'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
         $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'], 'entry_zone_id' => $shipping_address['entry_zone_id']);
     }
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value'], 'payment_method' => $payment, 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), 'comments' => tep_session_is_registered('comments') && !empty($comments) ? $comments : '');
     if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
         if (isset($GLOBALS[$payment]->public_title)) {
             $this->info['payment_method'] = $GLOBALS[$payment]->public_title;
         } else {
             $this->info['payment_method'] = $GLOBALS[$payment]->title;
         }
         if (isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && $GLOBALS[$payment]->order_status > 0) {
             $this->info['order_status'] = $GLOBALS[$payment]->order_status;
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => tep_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => tep_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => tep_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $cart->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'image' => tep_get_products_image($products[$i]['id']), 'description' => tep_get_products_description($products[$i]['id']), 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             reset($products[$i]['attributes']);
             while (list($option, $value) = each($products[$i]['attributes'])) {
                 $attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int) $products[$i]['id'] . "' and pa.options_id = '" . (int) $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int) $languages_id . "' and poval.language_id = '" . (int) $languages_id . "'");
                 $attributes = tep_db_fetch_array($attributes_query);
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
Пример #2
0
      Copyright (c) 2003 osCommerce
    
      Released under the GNU General Public License
    */
    if (defined('MODULE_SHOPBYPRICE_RANGES') && MODULE_SHOPBYPRICE_RANGES > 0) {
        ?>
<!-- shop_by_price eof//-->
    <div class="well" style="border:3px solid red">
      <div class="box-header small-margin-bottom small-margin-left"><?php 
        echo BOX_HEADING_SPECIALS;
        ?>
</div>
      <?php 
        foreach ($specials->rows as $product_specials22) {
            $product_specials22_id = $product_specials22['products_id'];
            $product_specials22_image = tep_get_products_image($product_specials22['products_id']);
            $product_specials22_name = tep_get_products_name($product_specials22['products_id']);
            $pf->loadProduct($product_specials22['products_id'], $languages_id);
            $special_random_price = $pf->getPriceStringShort();
            echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_specials22_id) . '">' . tep_image(DIR_WS_IMAGES . $product_specials22_image, $product_specials22_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_specials22_id) . '">' . $product_specials22_name . '</a><br>' . $special_random_price;
        }
        ?>

    </div>
  <?php 
    }
    ?>



Пример #3
0
  Copyright (c) 2008 CRE Loaded
  Copyright (c) 2008 AlogoZone, Inc.
  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
$whats = new box_whats_new();
if (count($whats->rows) > 0) {
    ?>
  <!-- whats_new //-->
     <div class="well">
      <div class="box-header small-margin-bottom small-margin-left"><?php 
    echo BOX_HEADING_WHATS_NEW;
    ?>
</div>
      <?php 
    foreach ($whats->rows as $whatsnew_product21) {
        $whatsnew_product21_id = $whatsnew_product21['products_id'];
        $whatsnew_product21_image = tep_get_products_image($whatsnew_product21['products_id']);
        $whatsnew_product21_name = tep_get_products_name($whatsnew_product21['products_id']);
        $pf->loadProduct($whatsnew_product21['products_id'], $languages_id);
        $whats_new_price = $pf->getPriceStringShort();
        echo '<div style="text-align:center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $whatsnew_product21_id) . '">' . tep_image(DIR_WS_IMAGES . $whatsnew_product21_image, $whatsnew_product21_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $whatsnew_product21_id) . '">' . $whatsnew_product21_name . '</a><br>' . $whats_new_price . '<br></div>';
    }
    ?>

	 </div>
  <!-- whats_new eof//-->
  <?php 
}