Ejemplo n.º 1
0
 function initialize()
 {
     global $osC_Cache, $osC_Database, $osC_Services, $osC_Currencies, $osC_Specials, $osC_Language, $osC_Image;
     $this->_title_link = osc_href_link(FILENAME_PRODUCTS, 'new');
     $data = array();
     if (BOX_WHATS_NEW_CACHE > 0 && $osC_Cache->read('box-whats_new-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), BOX_WHATS_NEW_CACHE)) {
         $data = $osC_Cache->getCache();
     } else {
         $Qnew = $osC_Database->query('select products_id from :table_products where products_status = :products_status order by products_date_added desc limit :max_random_select_new');
         $Qnew->bindTable(':table_products', TABLE_PRODUCTS);
         $Qnew->bindInt(':products_status', 1);
         $Qnew->bindInt(':max_random_select_new', BOX_WHATS_NEW_RANDOM_SELECT);
         $Qnew->executeRandomMulti();
         if ($Qnew->numberOfRows()) {
             $osC_Product = new osC_Product($Qnew->valueInt('products_id'));
             $data = $osC_Product->getData();
             $data['display_price'] = $osC_Product->getPriceFormated(true);
             $data['display_image'] = $osC_Product->getImage();
         }
         $osC_Cache->write($data);
     }
     if (!empty($data)) {
         $this->_content = '';
         if (!empty($data['display_image'])) {
             $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['keyword']), $osC_Image->show($data['display_image'], $data['name'])) . '<br />';
         }
         $this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['keyword']), $data['name']) . '<br />' . $data['display_price'];
     }
 }
Ejemplo n.º 2
0
 function initialize()
 {
     global $osC_Database, $osC_Cache, $osC_Language, $osC_Currencies, $osC_Image, $current_category_id;
     $data = array();
     if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0 && $osC_Cache->read('new_products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE)) {
         $data = $osC_Cache->getCache();
     } else {
         if ($current_category_id < 1) {
             $Qproducts = $osC_Database->query('select products_id from :table_products where products_status = :products_status and parent_id is null order by products_date_added desc limit :max_display_new_products');
         } else {
             $Qproducts = $osC_Database->query('select distinct p2c.products_id from :table_products p, :table_products_to_categories p2c, :table_categories c where c.parent_id = :category_parent_id and c.categories_id = p2c.categories_id and p2c.products_id = p.products_id and p.products_status = :products_status and p.parent_id is null order by p.products_date_added desc limit :max_display_new_products');
             $Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
             $Qproducts->bindTable(':table_categories', TABLE_CATEGORIES);
             $Qproducts->bindInt(':category_parent_id', $current_category_id);
         }
         $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
         $Qproducts->bindInt(':products_status', 1);
         $Qproducts->bindInt(':max_display_new_products', MODULE_CONTENT_NEW_PRODUCTS_MAX_DISPLAY);
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $osC_Product = new osC_Product($Qproducts->valueInt('products_id'));
             $data[$osC_Product->getID()] = $osC_Product->getData();
             $data[$osC_Product->getID()]['display_price'] = $osC_Product->getPriceFormated(true);
             $data[$osC_Product->getID()]['display_image'] = $osC_Product->getImage();
         }
         $osC_Cache->write($data);
     }
     if (!empty($data)) {
         $this->_content = '<div style="overflow: auto; height: 100%;">';
         foreach ($data as $product) {
             $this->_content .= '<span style="width: 33%; float: left; text-align: center;">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $product['keyword']), $osC_Image->show($product['display_image'], $product['name'])) . '<br />' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $product['keyword']), $product['name']) . '<br />' . $product['display_price'] . '</span>';
         }
         $this->_content .= '</div>';
     }
 }
Ejemplo n.º 3
0
 function getProducts()
 {
     global $osC_Database, $osC_Language, $toC_Json, $osC_Image;
     if (defined('IMAGE_GROUP_AUTO_COMPLETER')) {
         $image_group = IMAGE_GROUP_AUTO_COMPLETER;
     } else {
         $image_group = 'mini';
     }
     if (defined('MAX_CHARACTERS_AUTO_COMPLETER')) {
         $max_name_len = MAX_CHARACTERS_AUTO_COMPLETER;
     } else {
         $max_name_len = 40;
     }
     $products = array();
     if (isset($_POST['keywords']) && !empty($_POST['keywords'])) {
         $Qproducts = $osC_Database->query("select distinct p.products_id as products_id, pd.products_name from :table_products_description pd, :table_products p where pd.products_id = p.products_id and p.products_status = :products_status and products_name like :keywords and language_id =" . $osC_Language->getID() . ' limit :max_results');
         $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
         $Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
         $Qproducts->bindInt(':products_status', 1);
         $Qproducts->bindInt(':max_results', MAX_DISPLAY_AUTO_COMPLETER_RESULTS);
         $Qproducts->bindValue(':keywords', '%' . $_POST['keywords'] . '%');
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $osC_Product = new osC_Product($Qproducts->valueInt('products_id'));
             $products_name = $Qproducts->value('products_name');
             if (strlen($products_name) > $max_name_len) {
                 $products_name = substr($products_name, 0, $max_name_len) . '...';
             }
             $products[] = '<div class="image">' . $osC_Image->show($osC_Product->getImage(), null, null, $image_group) . '</div><div class="details">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->valueInt('products_id')), $products_name) . '<strong class="price">' . $osC_Product->getPriceFormated(true) . '</strong></div>';
         }
     }
     echo $toC_Json->encode($products);
 }
Ejemplo n.º 4
0
 /**
  * Add a product or variant product into the wishlist
  * 
  * @access public
  * @param mixed products id or products id string including the variants such as 1#1:1;2:3
  * @return boolean
  */
 function add($products_id_string)
 {
     global $osC_Database, $osC_Services, $osC_Customer, $osC_Product;
     //flag to reprent the action performed or not
     $error = false;
     // if wishlist empty, create a new wishlist
     if (!$this->hasWishlistID()) {
         $token = $this->generateToken();
         $Qnew = $osC_Database->query('insert into :table_wishlists (customers_id, wishlists_token) values (:customers_id, :wishlists_token)');
         $Qnew->bindTable(':table_wishlists', TABLE_WISHLISTS);
         $Qnew->bindInt(':customers_id', $osC_Customer->getID());
         $Qnew->bindValue(':wishlists_token', $token);
         $Qnew->execute();
         $this->_wishlists_id = $osC_Database->nextID();
         $this->_token = $token;
         $Qnew->freeResult();
     }
     if (!isset($osC_Product)) {
         $osC_Product = new osC_Product($products_id_string);
     }
     if ($osC_Product->getID() > 0) {
         if (!$this->exists($products_id_string)) {
             $product_price = $osC_Product->getPrice();
             $product_name = $osC_Product->getTitle();
             $product_image = $osC_Product->getImage();
             if ($osC_Services->isStarted('specials')) {
                 global $osC_Specials;
                 if ($new_price = $osC_Specials->getPrice($products_id)) {
                     $price = $new_price;
                 }
             }
             // if the product has variants, set the image, price etc according to the variants
             if ($osC_Product->hasVariants()) {
                 $variant_product = $this->_updateProduct($products_id_string, $osC_Product, $product_name);
                 $product_name = $variant_product['name'];
                 $product_price = $variant_product['price'];
                 $product_image = $variant_product['image'];
             }
             $this->_contents[$products_id_string] = array('products_id_string' => $products_id_string, 'name' => $product_name, 'image' => $product_image, 'price' => $product_price, 'date_added' => osC_DateTime::getShort(osC_DateTime::getNow()), 'comments' => '');
             // insert into wishlist products only if there isn't the same product existing in the table
             $QnewCheck = $osC_Database->query('select * from :table_wishlist_products where products_id_string = :products_id_string limit 1');
             $QnewCheck->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
             $QnewCheck->bindValue(':products_id_string', $products_id_string);
             $QnewCheck->execute();
             if ($QnewCheck->numberOfRows() < 1) {
                 $Qnew = $osC_Database->query('insert into :table_wishlist_products (wishlists_id, products_id_string, date_added, comments) values (:wishlists_id, :products_id_string, now(), :comments)');
                 $Qnew->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
                 $Qnew->bindInt(':wishlists_id', $this->_wishlists_id);
                 $Qnew->bindValue(':products_id_string', $products_id_string);
                 $Qnew->bindValue(':comments', '');
                 $Qnew->execute();
                 $wishlists_products_id = $osC_Database->nextID();
             } else {
                 $wishlists_products_id = $QnewCheck->valueInt('wishlists_products_id');
             }
             $QnewCheck->freeResult();
         } else {
             $error = true;
         }
     }
     if ($error === true) {
         return false;
     }
     return true;
 }
Ejemplo n.º 5
0
 function buildProductsRss($group)
 {
     global $osC_Language, $osC_Image;
     $group_title = $group . '_products';
     $rss = array();
     $rss['rss'] = array();
     $rss['rss attr'] = array('xmlns:atom' => 'http://www.w3.org/2005/Atom', 'version' => '2.0');
     //channel
     $rss['rss']['channel'] = array('title' => '<![CDATA[' . $osC_Language->get($group_title) . ']]>', 'link' => '<![CDATA[' . osc_href_link(FILENAME_PRODUCTS, $group) . ']]>', 'description' => '<![CDATA[' . $osC_Language->get($group_title) . ']]>', 'pubDate' => date("D, d M Y H:i:s O"));
     //items
     if ($group == "new") {
         $Qproducts = osC_Product::getListingNew();
     } else {
         if ($group == 'special') {
             $Qproducts = osC_Specials::getListing();
         } else {
             if ($group == 'feature') {
                 $Qproducts = osC_Product::getListingFeature();
             }
         }
     }
     $items = array();
     while ($Qproducts->next()) {
         $osC_Product = new osC_Product($Qproducts->valueInt('products_id'));
         $link = osc_href_link(FILENAME_PRODUCTS, $Qproducts->valueInt('products_id'), 'NONSSL', false, false, true);
         $description = '
     <![CDATA[
     <table>
       <tr>
         <td align="center" valign="top">' . osc_link_object($link, osc_image($osC_Image->getImageUrl($osC_Product->getImage(), 'product_info'), $osC_Product->getTitle())) . '</td>
         <td valign="top">' . $osC_Product->getDescription() . '</td>
       </tr>
     </table>
     ]]>';
         $items[] = array('title' => '<![CDATA[' . $osC_Product->getTitle() . ' -- ' . $osC_Product->getPriceFormated() . ']]>', 'link' => '<![CDATA[' . $link . ']]>', 'description' => $description, 'pubDate' => date("D, d M Y H:i:s O"));
     }
     $rss['rss']['channel']['item'] = $items;
     return $rss;
 }
 function add($products_id, $variants = array())
 {
     global $osC_Database, $osC_Services, $osC_Customer, $osC_Product;
     //if wishlist empty, create a new wishlist
     if (!$this->hasWishlistID()) {
         $token = $this->generateToken();
         $Qnew = $osC_Database->query('insert into :table_wishlists (customers_id, wishlists_token) values (:customers_id, :wishlists_token)');
         $Qnew->bindTable(':table_wishlists', TABLE_WISHLISTS);
         $Qnew->bindInt(':customers_id', $osC_Customer->getID());
         $Qnew->bindValue(':wishlists_token', $token);
         $Qnew->execute();
         $this->_wishlists_id = $osC_Database->nextID();
         $this->_token = $token;
         $Qnew->freeResult();
     }
     if (!isset($osC_Product)) {
         $osC_Product = new osC_Product($products_id);
     }
     if ($osC_Product->getID() > 0) {
         if (!$this->exists($products_id)) {
             $product_price = $osC_Product->getPrice();
             $product_name = $osC_Product->getTitle();
             $product_image = $osC_Product->getImage();
             if ($osC_Services->isStarted('specials')) {
                 global $osC_Specials;
                 if ($new_price = $osC_Specials->getPrice($products_id)) {
                     $price = $new_price;
                 }
             }
             //if the product has variants, set the image, price etc according to the variants
             if ($osC_Product->hasVariants()) {
                 $products_variants = $osC_Product->getVariants();
                 if (is_array($variants) && !osc_empty($variants)) {
                     $product_id_string = osc_get_product_id_string($products_id, $variants);
                     $products_variant = $products_variants[$product_id_string];
                 } else {
                     $products_variant = $osC_Product->getDefaultVariant();
                 }
                 $variants_groups_id = $products_variant['groups_id'];
                 $variants_groups_name = $products_variant['groups_name'];
                 if (!osc_empty($variants_groups_name)) {
                     $product_name .= '<br />';
                     foreach ($variants_groups_name as $group_name => $value_name) {
                         $product_name .= '<em>' . $group_name . ': ' . $value_name . '</em>' . '<br />';
                     }
                 }
                 $product_price = $products_variant['price'];
                 $product_image = $products_variant['image'];
             }
             $this->_contents[$products_id] = array('products_id' => $products_id, 'name' => $product_name, 'image' => $product_image, 'price' => $product_price, 'date_added' => osC_DateTime::getShort(osC_DateTime::getNow()), 'variants' => $variants, 'comments' => '');
             //insert into wishlist products
             $Qnew = $osC_Database->query('insert into :table_wishlist_products (wishlists_id, products_id, date_added, comments) values (:wishlists_id, :products_id, now(), :comments)');
             $Qnew->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
             $Qnew->bindInt(':wishlists_id', $this->_wishlists_id);
             $Qnew->bindInt(':products_id', $products_id);
             $Qnew->bindValue(':comments', '');
             $Qnew->execute();
             $wishlists_products_id = $osC_Database->nextID();
             $Qnew->freeResult();
             //if the wishlists products has variants
             $products_variants_groups_id = array();
             $products_variants_groups_name = array();
             if (isset($variants_groups_id) && isset($variants_groups_name)) {
                 foreach ($variants_groups_id as $groups_id => $values_id) {
                     $products_variants_groups_id[] = array('groups_id' => $groups_id, 'values_id' => $values_id);
                 }
                 foreach ($variants_groups_name as $groups_name => $values_name) {
                     $products_variants_groups_name[] = array('groups_name' => $groups_name, 'values_name' => $values_name);
                 }
             }
             if (!osc_empty($products_variants_groups_id)) {
                 foreach ($products_variants_groups_id as $key => $groups_id) {
                     $Qinsert = $osC_Database->query('insert into :table_wishlists_products_variants (wishlists_id, wishlists_products_id, products_variants_groups_id, products_variants_groups, products_variants_values_id, products_variants_values) values (:wishlists_id, :wishlists_products_id, :products_variants_groups_id, :products_variants_groups, :products_variants_values_id, :products_variants_values)');
                     $Qinsert->bindTable(':table_wishlists_products_variants', TABLE_WISHLISTS_PRODUCTS_VARIANTS);
                     $Qinsert->bindInt(':wishlists_id', $this->_wishlists_id);
                     $Qinsert->bindInt(':wishlists_products_id', $wishlists_products_id);
                     $Qinsert->bindInt(':products_variants_groups_id', $groups_id['groups_id']);
                     $Qinsert->bindInt(':products_variants_values_id', $groups_id['values_id']);
                     $Qinsert->bindValue(':products_variants_groups', $products_variants_groups_name[$key]['groups_name']);
                     $Qinsert->bindValue(':products_variants_values', $products_variants_groups_name[$key]['values_name']);
                     $Qinsert->execute();
                 }
             }
         }
     }
 }
 function getProducts()
 {
     $history = array();
     if (isset($this->visits['products']) && empty($this->visits['products']) === false) {
         $counter = 0;
         foreach ($this->visits['products'] as $k => $v) {
             $counter++;
             $osC_Product = new osC_Product($v['id']);
             $osC_Category = new osC_Category($osC_Product->getCategoryID());
             if ($osC_Product->isValid() === true) {
                 $history[] = array('name' => $osC_Product->getTitle(), 'id' => $osC_Product->getID(), 'keyword' => $osC_Product->getKeyword(), 'price' => SERVICE_RECENTLY_VISITED_SHOW_PRODUCT_PRICES == '1' ? $osC_Product->getPriceFormated(true) : '', 'image' => $osC_Product->getImage(), 'category_name' => $osC_Category->getTitle(), 'category_path' => $osC_Category->getPath());
             }
             if ($counter == SERVICE_RECENTLY_VISITED_MAX_PRODUCTS) {
                 break;
             }
         }
     }
     return $history;
 }
Ejemplo n.º 8
0
 function add($products_id_string, $variants = null, $quantity = null, $gift_certificates_data = null, $action = 'add')
 {
     global $osC_Database, $osC_Services, $osC_Language, $osC_Customer, $osC_Image, $toC_Wishlist;
     $products_id = osc_get_product_id($products_id_string);
     $osC_Product = new osC_Product($products_id);
     if ($osC_Product->isGiftCertificate()) {
         if ($variants == null || empty($variants)) {
             $products_id_string = $products_id . '#' . time();
         } else {
             $products_id_string = $products_id . '#' . $variants;
             //set variants to null
             $variants = null;
         }
     } else {
         $products_id_string = osc_get_product_id_string($products_id_string, $variants);
     }
     if ($osC_Product->getID() > 0) {
         if ($toC_Wishlist->hasProduct($products_id)) {
             $toC_Wishlist->deleteProduct($products_id);
         }
         if ($this->exists($products_id_string)) {
             if (!is_numeric($quantity)) {
                 $quantity = $this->getQuantity($products_id_string) + 1;
             } else {
                 if (is_numeric($quantity) && $quantity == 0) {
                     $this->remove($products_id_string);
                     return;
                 } else {
                     if ($action == 'add') {
                         $quantity = $this->getQuantity($products_id_string) + $quantity;
                     } else {
                         if ($action == 'update') {
                             $quantity = $quantity;
                         }
                     }
                 }
             }
             if ($osC_Product->isGiftCertificate()) {
                 if ($quantity > 1) {
                     $quantity = 1;
                     $error = $osC_Language->get('error_gift_certificate_quantity_must_be_one');
                 }
             }
             //check minimum order quantity
             $products_moq = $osC_Product->getMOQ();
             if ($quantity < $products_moq) {
                 $quantity = $products_moq;
                 $error = sprintf($osC_Language->get('error_minimum_order_quantity'), $osC_Product->getTitle(), $products_moq);
             }
             //check maximum order quantity
             $products_max_order_quantity = $osC_Product->getMaxOrderQuantity();
             if ($products_max_order_quantity > 0) {
                 if ($quantity > $products_max_order_quantity) {
                     $quantity = $products_max_order_quantity;
                     $error = sprintf($osC_Language->get('error_maximum_order_quantity'), $osC_Product->getTitle(), $products_max_order_quantity);
                 }
             }
             //check order increment
             $increment = $osC_Product->getOrderIncrement();
             if (($quantity - $products_moq) % $increment != 0) {
                 $quantity = $products_moq + (floor(($quantity - $products_moq) / $increment) + 1) * $increment;
                 $error = sprintf($osC_Language->get('error_order_increment'), $osC_Product->getTitle(), $increment);
             }
             //set error to session
             if (isset($error) && !empty($error)) {
                 $this->_contents[$products_id_string]['error'] = $error;
             }
             if ($osC_Product->isGiftCertificate() && $osC_Product->isOpenAmountGiftCertificate()) {
                 $price = $this->_contents[$products_id_string]['price'];
             } else {
                 $price = $osC_Product->getPrice($variants, $quantity);
                 if ($osC_Services->isStarted('specials')) {
                     global $osC_Specials;
                     if ($new_price = $osC_Specials->getPrice($products_id)) {
                         $price = $new_price;
                     }
                 }
             }
             $this->_contents[$products_id_string]['quantity'] = $quantity;
             $this->_contents[$products_id_string]['price'] = $price;
             $this->_contents[$products_id_string]['final_price'] = $price;
             // update database
             if ($osC_Customer->isLoggedOn()) {
                 $Qupdate = $osC_Database->query('update :table_customers_basket set customers_basket_quantity = :customers_basket_quantity, gift_certificates_data = :gift_certificates_data where customers_id = :customers_id and products_id = :products_id');
                 $Qupdate->bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
                 $Qupdate->bindInt(':customers_basket_quantity', $quantity);
                 if ($osC_Product->getProductType() == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                     $Qupdate->bindValue(':gift_certificates_data', serialize($gift_certificates_data));
                 } else {
                     $Qupdate->bindRaw(':gift_certificates_data', 'null');
                 }
                 $Qupdate->bindInt(':customers_id', $osC_Customer->getID());
                 $Qupdate->bindValue(':products_id', $products_id_string);
                 $Qupdate->execute();
             }
         } else {
             if (!is_numeric($quantity)) {
                 $quantity = 1;
             }
             if ($osC_Product->isGiftCertificate()) {
                 if ($quantity > 1) {
                     $quantity = 1;
                     $error = $osC_Language->get('error_gift_certificate_quantity_must_be_one');
                 }
             }
             //check minimum order quantity
             $products_moq = $osC_Product->getMOQ();
             if ($quantity < $products_moq) {
                 $quantity = $products_moq;
                 $error = sprintf($osC_Language->get('error_minimum_order_quantity'), $osC_Product->getTitle(), $products_moq);
             }
             //check order increment
             $increment = $osC_Product->getOrderIncrement();
             if (($quantity - $products_moq) % $increment != 0) {
                 $quantity = $products_moq + (floor(($quantity - $products_moq) / $increment) + 1) * $increment;
                 $error = sprintf($osC_Language->get('error_order_increment'), $osC_Product->getTitle(), $increment);
             }
             if ($osC_Product->isGiftCertificate() && $osC_Product->isOpenAmountGiftCertificate()) {
                 $price = $gift_certificates_data['price'];
             } else {
                 $price = $osC_Product->getPrice($variants, $quantity);
                 if ($osC_Services->isStarted('specials')) {
                     global $osC_Specials;
                     if ($new_price = $osC_Specials->getPrice($products_id)) {
                         $price = $new_price;
                     }
                 }
             }
             $this->_contents[$products_id_string] = array('id' => $products_id_string, 'name' => $osC_Product->getTitle(), 'type' => $osC_Product->getProductType(), 'keyword' => $osC_Product->getKeyword(), 'sku' => $osC_Product->getSKU($variants), 'image' => $osC_Product->getImage(), 'price' => $price, 'final_price' => $price, 'quantity' => $quantity, 'weight' => $osC_Product->getWeight($variants), 'tax_class_id' => $osC_Product->getTaxClassID(), 'date_added' => osC_DateTime::getShort(osC_DateTime::getNow()), 'weight_class_id' => $osC_Product->getWeightClass(), 'gc_data' => $gift_certificates_data);
             //set error to session
             if (isset($error) && !empty($error)) {
                 $this->_contents[$products_id_string]['error'] = $error;
             }
             // insert into database
             if ($osC_Customer->isLoggedOn()) {
                 $Qnew = $osC_Database->query('insert into :table_customers_basket (customers_id, products_id, customers_basket_quantity, gift_certificates_data, customers_basket_date_added) values (:customers_id, :products_id, :customers_basket_quantity, :gift_certificates_data, now())');
                 $Qnew->bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
                 $Qnew->bindInt(':customers_id', $osC_Customer->getID());
                 $Qnew->bindValue(':products_id', $products_id_string);
                 $Qnew->bindInt(':customers_basket_quantity', $quantity);
                 if ($osC_Product->getProductType() == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                     $Qnew->bindValue(':gift_certificates_data', serialize($gift_certificates_data));
                 } else {
                     $Qnew->bindRaw(':gift_certificates_data', 'null');
                 }
                 $Qnew->execute();
             }
             if (is_array($variants) && !empty($variants)) {
                 foreach ($variants as $group_id => $value_id) {
                     $Qvariants = $osC_Database->query('select pvg.products_variants_groups_name, pvv.products_variants_values_name from :table_products_variants pv, :table_products_variants_entries pve, :table_products_variants_groups pvg, :table_products_variants_values pvv where pv.products_id = :products_id and pv.products_variants_id = pve.products_variants_id and pve.products_variants_groups_id = :groups_id and pve.products_variants_values_id = :variants_values_id and pve.products_variants_groups_id = pvg.products_variants_groups_id and pve.products_variants_values_id = pvv.products_variants_values_id and pvg.language_id = :language_id and pvv.language_id = :language_id');
                     $Qvariants->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
                     $Qvariants->bindTable(':table_products_variants_entries', TABLE_PRODUCTS_VARIANTS_ENTRIES);
                     $Qvariants->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                     $Qvariants->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                     $Qvariants->bindInt(':products_id', $osC_Product->getID());
                     $Qvariants->bindInt(':groups_id', $group_id);
                     $Qvariants->bindInt(':variants_values_id', $value_id);
                     $Qvariants->bindInt(':language_id', $osC_Language->getID());
                     $Qvariants->bindInt(':language_id', $osC_Language->getID());
                     $Qvariants->execute();
                     $this->_contents[$products_id_string]['variants'][$group_id] = array('groups_id' => $group_id, 'variants_values_id' => $value_id, 'groups_name' => $Qvariants->value('products_variants_groups_name'), 'values_name' => $Qvariants->value('products_variants_values_name'));
                 }
             }
         }
         $this->_cleanUp();
         $this->_calculate();
     }
 }
Ejemplo n.º 9
0
?>

<?php 
if ($osC_Product->hasAccessories()) {
    $accessories = $osC_Product->getAccessories();
    ?>
    <div id="tabAccessories">
      <div class="moduleBox">
        <div class="content">
          <?php 
    foreach ($accessories as $accessory) {
        $product = new osC_Product($accessory);
        ?>
          <div class="accessories">
            <div class="image"><?php 
        echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $accessory), $osC_Image->show($product->getImage(), $product->getTitle()));
        ?>
</div>
            <div class="desc">
              <h6><?php 
        echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $accessory), $product->getTitle());
        ?>
</h6>
              <p><?php 
        echo $product->getShortDescription();
        ?>
</p>
            </div>
          </div>
          <div style="clear: both"></div>
          <?php 
Ejemplo n.º 10
0
 function add($products_id)
 {
     global $osC_Database, $osC_Services, $osC_Customer;
     //if wishlist empty, create a new wishlist
     if (!$this->hasWishlistID()) {
         $token = $this->generateToken();
         $Qnew = $osC_Database->query('insert into :table_wishlists (customers_id, wishlists_token) values (:customers_id, :wishlists_token)');
         $Qnew->bindTable(':table_wishlists', TABLE_WISHLISTS);
         if (!$osC_Customer->isLoggedOn()) {
             $Qnew->bindRaw(':customers_id', 'null');
         } else {
             $Qnew->bindInt(':customers_id', $osC_Customer->getID());
         }
         $Qnew->bindValue(':wishlists_token', $token);
         $Qnew->execute();
         $this->_wishlists_id = $osC_Database->nextID();
         $this->_token = $token;
     }
     $osC_Product = new osC_Product($products_id);
     if ($osC_Product->getID() > 0) {
         if (!$this->exists($products_id)) {
             $price = $osC_Product->getPrice();
             if ($osC_Services->isStarted('specials')) {
                 global $osC_Specials;
                 if ($new_price = $osC_Specials->getPrice($products_id)) {
                     $price = $new_price;
                 }
             }
             $this->_contents[$products_id] = array('products_id' => $products_id, 'name' => $osC_Product->getTitle(), 'image' => $osC_Product->getImage(), 'price' => $price, 'date_added' => osC_DateTime::getShort(osC_DateTime::getNow()), 'comments' => '');
             $Qnew = $osC_Database->query('insert into :table_wishlist_products (wishlists_id, products_id, date_added, comments) values (:wishlists_id, :products_id, now(), :comments)');
             $Qnew->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
             $Qnew->bindInt(':wishlists_id', $this->_wishlists_id);
             $Qnew->bindInt(':products_id', $products_id);
             $Qnew->bindValue(':comments', '');
             $Qnew->execute();
         }
     }
 }
Ejemplo n.º 11
0
$Qproducts->bindTable(':table_wishlist_products', TABLE_WISHLISTS_PRODUCTS);
$Qproducts->bindTable(':table_wishlist', TABLE_WISHLISTS);
$Qproducts->bindValue(':token', $_GET['token']);
$Qproducts->execute();
$rows = 0;
while ($Qproducts->next()) {
    $rows++;
    $osC_Product = new osC_Product($Qproducts->valueInt('products_id'));
    ?>

       <tr class="<?php 
    echo $rows / 2 == floor($rows / 2) ? 'productListing-even' : 'productListing-odd';
    ?>
">        
         <td align="center"><?php 
    echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()), $osC_Image->show($osC_Product->getImage(), $osC_Product->getTitle(), 'hspace="5" vspace="5"')) . '<br />' . $osC_Product->getTitle() . '<br />' . $osC_Currencies->format($osC_Product->getPrice());
    ?>
</td>         
         <td valign="top"><?php 
    echo $Qproducts->value('comments');
    ?>
</td>
         <td align="center" valign="top"><?php 
    echo osC_DateTime::getShort($Qproducts->value('date_added'));
    ?>
</td>
         <td align="center" valign="top"><?php 
    echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID() . '&action=cart_add'), osc_draw_image_button('button_in_cart.gif', $osC_Language->get('button_add_to_cart')));
    ?>
</td>
       </tr>    
Ejemplo n.º 12
0
                case 'PRODUCT_LIST_PRICE':
                    $lc_align = 'right';
                    $lc_text = '&nbsp;' . $osC_Product->getPriceFormated() . '&nbsp;';
                    break;
                case 'PRODUCT_LIST_QUANTITY':
                    $lc_align = 'right';
                    $lc_text = '&nbsp;' . $osC_Product->getQuantity() . '&nbsp;';
                    break;
                case 'PRODUCT_LIST_WEIGHT':
                    $lc_align = 'right';
                    $lc_text = '&nbsp;' . $osC_Product->getWeight() . '&nbsp;';
                    break;
                case 'PRODUCT_LIST_IMAGE':
                    $lc_align = 'center';
                    if (isset($_GET['manufacturers'])) {
                        $lc_text = osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword() . '&manufacturers=' . $_GET['manufacturers']), $osC_Image->show($osC_Product->getImage(), $osC_Product->getTitle()));
                    } else {
                        $lc_text = '&nbsp;' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword() . ($cPath ? '&cPath=' . $cPath : '')), $osC_Image->show($osC_Product->getImage(), $osC_Product->getTitle())) . '&nbsp;';
                    }
                    break;
                case 'PRODUCT_LIST_BUY_NOW':
                    $lc_align = 'center';
                    $lc_text = osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $osC_Product->getKeyword() . '&' . osc_get_all_get_params(array('action')) . '&action=cart_add'), osc_draw_image_button('button_buy_now.gif', $osC_Language->get('button_buy_now'))) . '&nbsp;';
                    break;
            }
            echo '      <td ' . (empty($lc_align) === false ? 'align="' . $lc_align . '" ' : '') . 'class="productListing-data">' . $lc_text . '</td>' . "\n";
        }
        echo '    </tr>' . "\n";
    }
    ?>
Ejemplo n.º 13
0
$osC_Products->setSortBy('date_added', '-');
$Qproducts = $osC_Products->execute();
if ($Qproducts->numberOfRows() > 0) {
    while ($Qproducts->next()) {
        $osC_Product = new osC_Product($Qproducts->valueInt('products_id'));
        ?>

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

<?php 
        if ($osC_Product->hasImage()) {
            echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()), $osC_Image->show($osC_Product->getImage(), $osC_Product->getTitle()));
        }
        ?>

    </td>
    <td valign="top"><?php 
        echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()), '<b><u>' . $osC_Product->getTitle() . '</u></b>') . '<br />' . $osC_Language->get('date_added') . ' ' . osC_DateTime::getLong($osC_Product->getDateAdded()) . '<br />' . $osC_Language->get('manufacturer') . ' ' . $osC_Product->getManufacturer() . '<br /><br />' . $osC_Language->get('price') . ' ' . $osC_Product->getPriceFormated();
        ?>
</td>
    <td align="right" valign="middle"><?php 
        echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword() . '&action=cart_add'), osc_draw_image_button('button_in_cart.gif', $osC_Language->get('button_add_to_cart')));
        ?>
</td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>