示例#1
0
use osCommerce\OM\Core\DateTime;
?>

<?php 
echo osc_image(DIR_WS_IMAGES . $OSCOM_Template->getPageImage(), $OSCOM_Template->getPageTitle(), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'id="pageIcon"');
?>

<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php 
$OSCOM_Products = new Products();
$OSCOM_Products->setSortBy('date_added', '-');
$Qproducts = $OSCOM_Products->execute();
if ($Qproducts->numberOfRows() > 0) {
    while ($Qproducts->next()) {
        $OSCOM_Product = new Product($Qproducts->valueInt('products_id'));
        ?>

  <tr>
    <td width="<?php 
        echo $OSCOM_Image->getWidth('thumbnails') + 10;
        ?>
" valign="top" align="center">

<?php 
        if ($OSCOM_Product->hasImage()) {
示例#2
0
 public static function insert()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_Currencies = Registry::get('Currencies');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Tax = Registry::get('Tax');
     if (isset($_SESSION['prepOrderID'])) {
         $_prep = explode('-', $_SESSION['prepOrderID']);
         if ($_prep[0] == $OSCOM_ShoppingCart->getCartID()) {
             return $_prep[1];
             // order_id
         } else {
             if (self::getStatusID($_prep[1]) === 4) {
                 self::remove($_prep[1]);
             }
         }
     }
     if ($OSCOM_Customer->isLoggedOn()) {
         $customer_address = AddressBook::getEntry($OSCOM_Customer->getDefaultAddressID());
     } else {
         $customer_address = array('company' => $OSCOM_ShoppingCart->getShippingAddress('company'), 'street_address' => $OSCOM_ShoppingCart->getShippingAddress('street_address'), 'suburb' => $OSCOM_ShoppingCart->getShippingAddress('suburb'), 'city' => $OSCOM_ShoppingCart->getShippingAddress('city'), 'postcode' => $OSCOM_ShoppingCart->getShippingAddress('postcode'), 'state' => $OSCOM_ShoppingCart->getShippingAddress('state'), 'zone_id' => $OSCOM_ShoppingCart->getShippingAddress('zone_id'), 'country_id' => $OSCOM_ShoppingCart->getShippingAddress('country_id'), 'telephone' => $OSCOM_ShoppingCart->getShippingAddress('telephone'));
     }
     $Qorder = $OSCOM_PDO->prepare('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_state_code, customers_country, customers_country_iso2, customers_country_iso3, customers_telephone, customers_email_address, customers_address_format, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_state_code, delivery_country, delivery_country_iso2, delivery_country_iso3, delivery_address_format, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_state_code, billing_country, billing_country_iso2, billing_country_iso3, billing_address_format, payment_method, payment_module, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city, :customers_postcode, :customers_state, :customers_state_code, :customers_country, :customers_country_iso2, :customers_country_iso3, :customers_telephone, :customers_email_address, :customers_address_format, :customers_ip_address, :delivery_name, :delivery_company, :delivery_street_address, :delivery_suburb, :delivery_city, :delivery_postcode, :delivery_state, :delivery_state_code, :delivery_country, :delivery_country_iso2, :delivery_country_iso3, :delivery_address_format, :billing_name, :billing_company, :billing_street_address, :billing_suburb, :billing_city, :billing_postcode, :billing_state, :billing_state_code, :billing_country, :billing_country_iso2, :billing_country_iso3, :billing_address_format, :payment_method, :payment_module, now(), :orders_status, :currency, :currency_value)');
     $Qorder->bindInt(':customers_id', $OSCOM_Customer->getID());
     $Qorder->bindValue(':customers_name', $OSCOM_Customer->getName());
     $Qorder->bindValue(':customers_company', $customer_address['company']);
     $Qorder->bindValue(':customers_street_address', $customer_address['street_address']);
     $Qorder->bindValue(':customers_suburb', $customer_address['suburb']);
     $Qorder->bindValue(':customers_city', $customer_address['city']);
     $Qorder->bindValue(':customers_postcode', $customer_address['postcode']);
     $Qorder->bindValue(':customers_state', $customer_address['state']);
     $Qorder->bindValue(':customers_state_code', Address::getZoneCode($customer_address['zone_id']));
     $Qorder->bindValue(':customers_country', Address::getCountryName($customer_address['country_id']));
     $Qorder->bindValue(':customers_country_iso2', Address::getCountryIsoCode2($customer_address['country_id']));
     $Qorder->bindValue(':customers_country_iso3', Address::getCountryIsoCode3($customer_address['country_id']));
     $Qorder->bindValue(':customers_telephone', $customer_address['telephone']);
     $Qorder->bindValue(':customers_email_address', $OSCOM_Customer->getEmailAddress());
     $Qorder->bindValue(':customers_address_format', Address::getFormat($customer_address['country_id']));
     $Qorder->bindValue(':customers_ip_address', OSCOM::getIPAddress());
     $Qorder->bindValue(':delivery_name', $OSCOM_ShoppingCart->getShippingAddress('firstname') . ' ' . $OSCOM_ShoppingCart->getShippingAddress('lastname'));
     $Qorder->bindValue(':delivery_company', $OSCOM_ShoppingCart->getShippingAddress('company'));
     $Qorder->bindValue(':delivery_street_address', $OSCOM_ShoppingCart->getShippingAddress('street_address'));
     $Qorder->bindValue(':delivery_suburb', $OSCOM_ShoppingCart->getShippingAddress('suburb'));
     $Qorder->bindValue(':delivery_city', $OSCOM_ShoppingCart->getShippingAddress('city'));
     $Qorder->bindValue(':delivery_postcode', $OSCOM_ShoppingCart->getShippingAddress('postcode'));
     $Qorder->bindValue(':delivery_state', $OSCOM_ShoppingCart->getShippingAddress('state'));
     $Qorder->bindValue(':delivery_state_code', $OSCOM_ShoppingCart->getShippingAddress('zone_code'));
     $Qorder->bindValue(':delivery_country', $OSCOM_ShoppingCart->getShippingAddress('country_title'));
     $Qorder->bindValue(':delivery_country_iso2', $OSCOM_ShoppingCart->getShippingAddress('country_iso_code_2'));
     $Qorder->bindValue(':delivery_country_iso3', $OSCOM_ShoppingCart->getShippingAddress('country_iso_code_3'));
     $Qorder->bindValue(':delivery_address_format', $OSCOM_ShoppingCart->getShippingAddress('format'));
     $Qorder->bindValue(':billing_name', $OSCOM_ShoppingCart->getBillingAddress('firstname') . ' ' . $OSCOM_ShoppingCart->getBillingAddress('lastname'));
     $Qorder->bindValue(':billing_company', $OSCOM_ShoppingCart->getBillingAddress('company'));
     $Qorder->bindValue(':billing_street_address', $OSCOM_ShoppingCart->getBillingAddress('street_address'));
     $Qorder->bindValue(':billing_suburb', $OSCOM_ShoppingCart->getBillingAddress('suburb'));
     $Qorder->bindValue(':billing_city', $OSCOM_ShoppingCart->getBillingAddress('city'));
     $Qorder->bindValue(':billing_postcode', $OSCOM_ShoppingCart->getBillingAddress('postcode'));
     $Qorder->bindValue(':billing_state', $OSCOM_ShoppingCart->getBillingAddress('state'));
     $Qorder->bindValue(':billing_state_code', $OSCOM_ShoppingCart->getBillingAddress('zone_code'));
     $Qorder->bindValue(':billing_country', $OSCOM_ShoppingCart->getBillingAddress('country_title'));
     $Qorder->bindValue(':billing_country_iso2', $OSCOM_ShoppingCart->getBillingAddress('country_iso_code_2'));
     $Qorder->bindValue(':billing_country_iso3', $OSCOM_ShoppingCart->getBillingAddress('country_iso_code_3'));
     $Qorder->bindValue(':billing_address_format', $OSCOM_ShoppingCart->getBillingAddress('format'));
     $Qorder->bindValue(':payment_method', $OSCOM_ShoppingCart->getBillingMethod('title'));
     // HPDL verify payment module class
     $Qorder->bindValue(':payment_module', $OSCOM_ShoppingCart->getBillingMethod('id'));
     $Qorder->bindInt(':orders_status', 4);
     // HPDL move currencies to the products level
     $Qorder->bindValue(':currency', $OSCOM_Currencies->getCode());
     $Qorder->bindValue(':currency_value', $OSCOM_Currencies->value($OSCOM_Currencies->getCode()));
     $Qorder->execute();
     $insert_id = $OSCOM_PDO->lastInsertId();
     foreach ($OSCOM_ShoppingCart->getOrderTotals() as $module) {
         $Qtotals = $OSCOM_PDO->prepare('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)');
         $Qtotals->bindInt(':orders_id', $insert_id);
         $Qtotals->bindValue(':title', $module['title']);
         $Qtotals->bindValue(':text', $module['text']);
         $Qtotals->bindValue(':value', $module['value']);
         $Qtotals->bindValue(':class', $module['code']);
         $Qtotals->bindInt(':sort_order', $module['sort_order']);
         $Qtotals->execute();
     }
     $Qstatus = $OSCOM_PDO->prepare('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, now(), :customer_notified, :comments)');
     $Qstatus->bindInt(':orders_id', $insert_id);
     $Qstatus->bindInt(':orders_status_id', 4);
     $Qstatus->bindInt(':customer_notified', '0');
     $Qstatus->bindValue(':comments', isset($_SESSION['comments']) ? $_SESSION['comments'] : '');
     $Qstatus->execute();
     foreach ($OSCOM_ShoppingCart->getProducts() as $products) {
         $Qproducts = $OSCOM_PDO->prepare('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :products_tax, :products_quantity)');
         $Qproducts->bindInt(':orders_id', $insert_id);
         $Qproducts->bindInt(':products_id', Products::getProductID($products['id']));
         $Qproducts->bindValue(':products_model', $products['model']);
         $Qproducts->bindValue(':products_name', $products['name']);
         $Qproducts->bindValue(':products_price', $products['price']);
         $Qproducts->bindValue(':products_tax', $OSCOM_Tax->getTaxRate($products['tax_class_id']));
         $Qproducts->bindInt(':products_quantity', $products['quantity']);
         $Qproducts->execute();
         $order_products_id = $OSCOM_PDO->lastInsertId();
         if ($OSCOM_ShoppingCart->isVariant($products['item_id'])) {
             foreach ($OSCOM_ShoppingCart->getVariant($products['item_id']) as $variant) {
                 /* HPDL
                             if (DOWNLOAD_ENABLED == '1') {
                               $Qattributes = $OSCOM_PDO->prepare('select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
                               $Qattributes->bindInt(':products_id', $products['id']);
                               $Qattributes->bindInt(':options_id', $attributes['options_id']);
                               $Qattributes->bindInt(':options_values_id', $attributes['options_values_id']);
                               $Qattributes->bindInt(':popt_language_id', $OSCOM_Language->getID());
                               $Qattributes->bindInt(':poval_language_id', $OSCOM_Language->getID());
                               $Qattributes->execute();
                             }
                 */
                 $Qvariant = $OSCOM_PDO->prepare('insert into :table_orders_products_variants (orders_id, orders_products_id, group_title, value_title) values (:orders_id, :orders_products_id, :group_title, :value_title)');
                 $Qvariant->bindInt(':orders_id', $insert_id);
                 $Qvariant->bindInt(':orders_products_id', $order_products_id);
                 $Qvariant->bindValue(':group_title', $variant['group_title']);
                 $Qvariant->bindValue(':value_title', $variant['value_title']);
                 $Qvariant->execute();
                 /*HPDL
                             if ((DOWNLOAD_ENABLED == '1') && (strlen($Qattributes->value('products_attributes_filename')) > 0)) {
                               $Qopd = $OSCOM_PDO->prepare('insert into :table_orders_products_download (orders_id, orders_products_id, orders_products_filename, download_maxdays, download_count) values (:orders_id, :orders_products_id, :orders_products_filename, :download_maxdays, :download_count)');
                               $Qopd->bindInt(':orders_id', $insert_id);
                               $Qopd->bindInt(':orders_products_id', $order_products_id);
                               $Qopd->bindValue(':orders_products_filename', $Qattributes->value('products_attributes_filename'));
                               $Qopd->bindValue(':download_maxdays', $Qattributes->value('products_attributes_maxdays'));
                               $Qopd->bindValue(':download_count', $Qattributes->value('products_attributes_maxcount'));
                               $Qopd->execute();
                             }
                 */
             }
         }
     }
     $_SESSION['prepOrderID'] = $OSCOM_ShoppingCart->getCartID() . '-' . $insert_id;
     return $insert_id;
 }
示例#3
0
 public function incrementCounter()
 {
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Language = Registry::get('Language');
     $Qupdate = $OSCOM_PDO->prepare('update :table_products_description set products_viewed = products_viewed+1 where products_id = :products_id and language_id = :language_id');
     $Qupdate->bindInt(':products_id', Products::getProductID($this->_data['id']));
     $Qupdate->bindInt(':language_id', $OSCOM_Language->getID());
     $Qupdate->execute();
 }
示例#4
0
use osCommerce\OM\Core\HTML;
use osCommerce\OM\Core\OSCOM;
use osCommerce\OM\Core\PDO;
use osCommerce\OM\Core\Site\Shop\Product;
use osCommerce\OM\Core\Site\Shop\Products;
?>

<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php 
$OSCOM_Products = new Products();
$OSCOM_Products->setSortBy('date_added', '-');
$products_listing = $OSCOM_Products->execute();
if ($products_listing['total'] > 0) {
    foreach ($products_listing['entries'] as $p) {
        $OSCOM_Product = new Product($p['products_id']);
        ?>

  <tr>
    <td width="<?php 
        echo $OSCOM_Image->getWidth('thumbnails') + 10;
        ?>
" valign="top" align="center">

<?php 
        if ($OSCOM_Product->hasImage()) {
            case 'PRODUCT_LIST_WEIGHT':
                $lc_text = OSCOM::getDef('listing_weight_heading');
                $lc_key = 'weight';
                $lc_align = 'right';
                break;
            case 'PRODUCT_LIST_IMAGE':
                $lc_text = OSCOM::getDef('listing_image_heading');
                $lc_align = 'center';
                break;
            case 'PRODUCT_LIST_BUY_NOW':
                $lc_text = OSCOM::getDef('listing_buy_now_heading');
                $lc_align = 'center';
                break;
        }
        if ($lc_key !== false) {
            $lc_text = Products::getListingSortLink($lc_key, $lc_text);
        }
        echo '      <td align="' . $lc_align . '" class="productListing-heading">&nbsp;' . $lc_text . '&nbsp;</td>' . "\n";
    }
    ?>

    </tr>

<?php 
    $rows = 0;
    foreach ($products_listing['entries'] as $p) {
        $OSCOM_Product = new Product($p['products_id']);
        $rows++;
        echo '    <tr class="' . ($rows / 2 == floor($rows / 2) ? 'productListing-even' : 'productListing-odd') . '">' . "\n";
        for ($col = 0, $n = sizeof($column_list); $col < $n; $col++) {
            $lc_align = '';
示例#6
0
<?php 
}
?>

<div>
  <?php 
echo $OSCOM_Product->getDescription();
?>
</div>

<?php 
if ($OSCOM_Service->isStarted('Reviews') && Reviews::exists(Products::getProductID($OSCOM_Product->getID()), true)) {
    ?>

<p><?php 
    echo OSCOM::getDef('number_of_product_reviews') . ' ' . Reviews::getTotal(Products::getProductID($OSCOM_Product->getID()));
    ?>
</p>

<?php 
}
if ($OSCOM_Product->hasURL()) {
    ?>

<p><?php 
    echo sprintf(OSCOM::getDef('go_to_external_products_webpage'), OSCOM::getLink(null, 'Redirect', 'action=url&goto=' . urlencode($OSCOM_Product->getURL()), 'NONSSL', null, false));
    ?>
</p>

<?php 
}