本文整理汇总了PHP中osC_Product类的典型用法代码示例。如果您正苦于以下问题:PHP osC_Product类的具体用法?PHP osC_Product怎么用?PHP osC_Product使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了osC_Product类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
function initialize()
{
global $osC_Database, $osC_Services, $osC_Language, $osC_Currencies, $osC_Image, $osC_Specials, $current_category_id;
if ($current_category_id < 1) {
$Qnewproducts = $osC_Database->query('select p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_keyword, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc limit :max_display_new_products');
} else {
$Qnewproducts = $osC_Database->query('select distinct p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_keyword, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd, :table_products_to_categories p2c, :table_categories c where c.parent_id = :parent_id and c.categories_id = p2c.categories_id and p2c.products_id = p.products_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc limit :max_display_new_products');
$Qnewproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
$Qnewproducts->bindTable(':table_categories', TABLE_CATEGORIES);
$Qnewproducts->bindInt(':parent_id', $current_category_id);
}
$Qnewproducts->bindTable(':table_products', TABLE_PRODUCTS);
$Qnewproducts->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
$Qnewproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
$Qnewproducts->bindInt(':default_flag', 1);
$Qnewproducts->bindInt(':language_id', $osC_Language->getID());
$Qnewproducts->bindInt(':max_display_new_products', MODULE_CONTENT_NEW_PRODUCTS_MAX_DISPLAY);
if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0) {
$Qnewproducts->setCache('new_products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE);
}
$Qnewproducts->execute();
if ($Qnewproducts->numberOfRows()) {
$i = 0;
while ($Qnewproducts->next()) {
if ($i % 3 == 0 && $i != 0) {
$this->_content .= '<div style="clear:both"></div>';
}
$product = new osC_Product($Qnewproducts->valueInt('products_id'));
$this->_content .= '<div style="margin-top: 10px; float:left; width: 33%; text-align: center">' . '<span style="display:block; height: 32px; text-align: center">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qnewproducts->value('products_id')), $Qnewproducts->value('products_name')) . '</span>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qnewproducts->value('products_id')), $osC_Image->show($Qnewproducts->value('image'), $Qnewproducts->value('products_name')), 'id="productImage' . $Qnewproducts->value('products_id') . '"') . '<span style="display:block; padding: 3px; text-align: center">' . $product->getPriceFormated(true) . '</span>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qnewproducts->valueInt('products_id') . '&action=cart_add'), osc_draw_image_button('button_add_to_cart.png', $osC_Language->get('button_add_to_cart'), 'class="ajaxAddToCart" id="ac_newproductsmodule_' . $Qnewproducts->value('products_id') . '"')) . '</div>';
$i++;
}
$this->_content .= '<div style="clear:both"></div>';
}
$Qnewproducts->freeResult();
}
示例2: initialize
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');
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 {
$data = array();
$Qnew = $osC_Database->query('select p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_keyword, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc limit :max_random_select_new');
$Qnew->bindTable(':table_products', TABLE_PRODUCTS);
$Qnew->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
$Qnew->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
$Qnew->bindInt(':default_flag', 1);
$Qnew->bindInt(':language_id', $osC_Language->getID());
$Qnew->bindInt(':max_random_select_new', BOX_WHATS_NEW_RANDOM_SELECT);
$Qnew->executeRandomMulti();
if ($Qnew->numberOfRows()) {
$data = $Qnew->toArray();
$osC_Product = new osC_Product($Qnew->valueInt('products_id'));
$products_price = $osC_Currencies->displayPrice($Qnew->valueDecimal('products_price'), $Qnew->valueInt('products_tax_class_id'));
if ($osC_Services->isStarted('specials') && $osC_Specials->isActive($Qnew->valueInt('products_id'))) {
$products_price = '<s>' . $products_price . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($osC_Specials->getPrice($Qnew->valueInt('products_id')), $Qnew->valueInt('products_tax_class_id')) . '</span>';
}
$data['products_price'] = $osC_Product->getPriceFormated(true);
}
$osC_Cache->writeBuffer($data);
}
if (empty($data) === false) {
$this->_content = '';
if (empty($data['image']) === false) {
$this->_content .= osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['products_id']), $osC_Image->show($data['image'], $data['products_name'])) . '<br />';
}
$this->_content .= '<span>' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $data['products_id']), $data['products_name']) . '</span><br /><span class="productPrice">' . $data['products_price'] . '</span>';
}
}
示例3: getProducts
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);
}
示例4: initialize
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'];
}
}
示例5: execute
function execute()
{
global $osC_Session, $osC_ShoppingCart;
$id = false;
foreach ($_GET as $key => $value) {
if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
$id = $key;
}
break;
}
if ($id !== false && osC_Product::checkEntry($id)) {
$osC_Product = new osC_Product($id);
$product_id = $osC_Product->getID();
//gift certificate use timestamp as variant
if ($osC_Product->isGiftCertificate()) {
$product_id .= '#' . $_GET['variants'];
} else {
if (isset($_GET['variants']) && ereg('^([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*$', $_GET['variants'])) {
$product_id .= '#' . $_GET['variants'];
}
}
$osC_ShoppingCart->remove($product_id);
}
osc_redirect(osc_href_link(FILENAME_CHECKOUT));
}
示例6: initialize
function initialize()
{
global $osC_Language, $osC_Template, $toC_Compare_Products;
if ($toC_Compare_Products->hasContents()) {
$osC_Template->addStyleSheet('ext/multibox/multibox.css');
$osC_Template->addJavascriptFilename('ext/multibox/Overlay.js');
$osC_Template->addJavascriptFilename('ext/multibox/MultiBox.js');
$this->_content = '<ul>';
foreach ($toC_Compare_Products->getProducts() as $products_id) {
$osC_Product = new osC_Product($products_id);
$this->_content .= '<li>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $products_id . '&' . osc_get_all_get_params(array('action')) . '&action=compare_products_remove'), osc_draw_image_button('button_delete_icon.png', $osC_Language->get('button_delete')), 'style="float: right; margin: 0 3px 1px 3px"') . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Product->getTitle()) . '</li>';
}
$this->_content .= '</ul>';
$this->_content .= '<p>' . '<span style="float: right">' . osc_link_object(osc_href_link(FILENAME_JSON, 'module=products&action=compare_products'), osc_draw_image_button('small_compare_now.png', $osC_Language->get('button_compare_now')), 'class="multibox" rel="width:800,height:400,ajax:true"') . '</span>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=compare_products_clear'), osc_draw_image_button('small_clear.png', $osC_Language->get('button_clear'))) . ' ' . '</p>';
$js .= '<script type="text/javascript">
window.addEvent("domready",function() {
var overlay = new Overlay();
var box = new MultiBox(\'multibox\', {
overlay: overlay
});
});
</script>';
$this->_content .= "\n" . $js;
}
}
示例7: execute
function execute()
{
global $osC_ShoppingCart;
if (isset($_POST['products']) && is_array($_POST['products']) && !empty($_POST['products'])) {
foreach ($_POST['products'] as $product => $quantity) {
if (!is_numeric($quantity)) {
return false;
}
$product = explode('#', $product, 2);
$variants_array = array();
if (isset($product[1])) {
$variants = explode(';', $product[1]);
foreach ($variants as $set) {
$variant = explode(':', $set);
if (is_numeric($variant[0]) && is_numeric($variant[1])) {
$variants_array[$variant[0]] = $variant[1];
}
}
}
$osC_Product = new osC_Product($product[0]);
if ($osC_Product->isGiftCertificate()) {
$variants_array = $product[1];
}
$osC_ShoppingCart->add($product[0], $variants_array, $quantity, null, 'update');
}
}
osc_redirect(osc_href_link(FILENAME_CHECKOUT));
}
示例8: initialize
function initialize()
{
global $osC_Database, $osC_Services, $osC_Language, $osC_Currencies, $osC_Image, $osC_Specials, $current_category_id;
if ($current_category_id < 1) {
$Qproducts = $osC_Database->query('select p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_keyword, pf.sort_order, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd, :table_products_frontpage pf where p.products_status = 1 and p.products_id = pd.products_id and pd.products_id = pf.products_id and pd.language_id = :language_id order by pf.sort_order limit :max_display_feature_products');
} else {
$Qproducts = $osC_Database->query('select distinct p.products_id, p.products_tax_class_id, p.products_price, pd.products_name, pf.sort_order, pd.products_keyword, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd, :table_products_to_categories p2c, :table_categories c, :table_products_frontpage pf where c.parent_id = :parent_id and c.categories_id = p2c.categories_id and p2c.products_id = p.products_id and p.products_id = pf.products_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by pf.sort_order limit :max_display_feature_products');
$Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
$Qproducts->bindTable(':table_categories', TABLE_CATEGORIES);
$Qproducts->bindInt(':parent_id', $current_category_id);
}
$Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
$Qproducts->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
$Qproducts->bindTable(':table_products_frontpage', TABLE_PRODUCTS_FRONTPAGE);
$Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
$Qproducts->bindInt(':default_flag', 1);
$Qproducts->bindInt(':language_id', $osC_Language->getID());
$Qproducts->bindInt(':max_display_feature_products', MODULE_CONTENT_FEATURE_PRODUCTS_MAX_DISPLAY);
$Qproducts->setCache('feature-products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id);
$Qproducts->execute();
if ($Qproducts->numberOfRows()) {
$this->_content = '<div style="overflow: auto; height: 100%;">';
$i = 0;
while ($Qproducts->next()) {
if ($i % 3 == 0 && $i != 0) {
$this->_content .= '<div style="clear:both"></div>';
}
$osC_Product = new osC_Product($Qproducts->valueInt('products_id'));
$this->_content .= '<span style="width: 32%; float: left; text-align: center; padding: 2px;">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->value('products_id')), $osC_Image->show($Qproducts->value('image'), $Qproducts->value('products_name'))) . '<br />' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->value('products_id')), $Qproducts->value('products_name')) . '<br />' . $osC_Product->getPriceFormated(true) . '</span>';
$i++;
}
$this->_content .= '</div>';
}
$Qproducts->freeResult();
}
示例9: osC_Products_Products
function osC_Products_Products()
{
global $osC_Database, $osC_Services, $osC_Session, $osC_Language, $osC_Breadcrumb, $osC_Product;
if (empty($_GET) === false) {
$id = false;
// PHP < 5.0.2; array_slice() does not preserve keys and will not work with numerical key values, so foreach() is used
foreach ($_GET as $key => $value) {
if ((preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$/', $key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && $key != $osC_Session->getName()) {
$id = $key;
}
break;
}
if ($id !== false && osC_Product::checkEntry($id)) {
$osC_Product = new osC_Product($id);
$osC_Product->incrementCounter();
$this->addPageTags('keywords', $osC_Product->getTitle());
$this->addPageTags('keywords', $osC_Product->getModel());
if ($osC_Product->hasTags()) {
$this->addPageTags('keywords', $osC_Product->getTags());
}
$this->addJavascriptFilename('templates/' . $this->getCode() . '/javascript/' . $this->_group . '/info.js');
osC_Services_category_path::process($osC_Product->getCategoryID());
if ($osC_Services->isStarted('breadcrumb')) {
$osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()));
}
$this->_page_title = $osC_Product->getTitle();
} else {
$this->_page_title = $osC_Language->get('product_not_found_heading');
$this->_page_contents = 'info_not_found.php';
}
} else {
$this->_page_title = $osC_Language->get('product_not_found_heading');
$this->_page_contents = 'info_not_found.php';
}
}
示例10: execute
function execute()
{
global $osC_Database, $osC_Session, $osC_NavigationHistory, $osC_Customer;
if (!$osC_Customer->isLoggedOn()) {
$osC_NavigationHistory->setSnapshot();
osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
return false;
}
$id = false;
foreach ($_GET as $key => $value) {
if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
$id = $key;
}
break;
}
if ($id !== false && osC_Product::checkEntry($id)) {
$osC_Product = new osC_Product($id);
$Qcheck = $osC_Database->query('select products_id from :table_products_notifications where customers_id = :customers_id and products_id = :products_id limit 1');
$Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
$Qcheck->bindInt(':customers_id', $osC_Customer->getID());
$Qcheck->bindInt(':products_id', $osC_Product->getID());
$Qcheck->execute();
if ($Qcheck->numberOfRows() > 0) {
$Qn = $osC_Database->query('delete from :table_products_notifications where customers_id = :customers_id and products_id = :products_id');
$Qn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
$Qn->bindInt(':customers_id', $osC_Customer->getID());
$Qn->bindInt(':products_id', $osC_Product->getID());
$Qn->execute();
}
}
osc_redirect(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action'))));
}
示例11: execute
function execute()
{
global $osC_Session, $osC_Product, $toC_Customization_Fields, $osC_Language, $messageStack;
if (!isset($osC_Product)) {
$id = false;
foreach ($_GET as $key => $value) {
if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
$id = $key;
}
break;
}
if ($id !== false && osC_Product::checkEntry($id)) {
$osC_Product = new osC_Product($id);
}
}
if (isset($osC_Product)) {
$errors = array();
$data = array();
$customizations = $osC_Product->getCustomizations();
foreach ($customizations as $field) {
$fields_id = $field['customization_fields_id'];
if ($field['type'] == CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT) {
$value = isset($_POST['customizations'][$fields_id]) ? $_POST['customizations'][$fields_id] : null;
if ($field['is_required'] && $value == null) {
$messageStack->add_session('products_customizations', sprintf($osC_Language->get('error_customization_field_must_be_specified'), $field['name']), 'error');
} else {
if ($value != null) {
$data[$fields_id] = array('customization_fields_id' => $field['customization_fields_id'], 'customization_fields_name' => $field['name'], 'customization_type' => CUSTOMIZATION_FIELD_TYPE_INPUT_TEXT, 'customization_value' => $value);
}
}
} else {
$file = new upload('customizations_' . $fields_id, DIR_FS_CACHE . '/products_customizations/');
if ($field['is_required'] && !$file->exists() && !$toC_Customization_Fields->hasCustomizationField($osC_Product->getID(), $fields_id)) {
$messageStack->add_session('products', sprintf($osC_Language->get('error_customization_field_must_be_specified'), $field['name']), 'error');
} else {
if ($file->exists()) {
if ($file->parse() && $file->save()) {
$filename = $file->filename;
$cache_filename = md5($filename . time());
rename(DIR_FS_CACHE . '/products_customizations/' . $filename, DIR_FS_CACHE . '/products_customizations/' . $cache_filename);
$data[$fields_id] = array('customization_fields_id' => $field['customization_fields_id'], 'customization_fields_name' => $field['name'], 'customization_type' => CUSTOMIZATION_FIELD_TYPE_INPUT_FILE, 'customization_value' => $filename, 'cache_filename' => $cache_filename);
} else {
$messageStack->add_session('products_customizations', $file->getLastError(), 'error');
}
}
}
}
}
//var_dump($data);exit;
if ($messageStack->size('products_customizations') === 0) {
$toC_Customization_Fields->set($osC_Product->getID(), $data);
}
}
osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
}
示例12: quote
public function quote()
{
global $osC_ShoppingCart, $osC_Weight;
$dest_country = $osC_ShoppingCart->getShippingAddress('country_iso_code_2');
$dest_zone = 0;
$error = false;
$shipping_method = null;
$shipping_cost = null;
$shipping_weight = 0;
foreach ($osC_ShoppingCart->getProducts() as $product) {
$osC_Product = new osC_Product($product['id']);
if ($osC_Product->isTypeActionAllowed('apply_shipping_fees')) {
$shipping_weight += $osC_Weight->convert($product['weight'], SHIPPING_WEIGHT_UNIT, MODULE_SHIPPING_ZONES_WEIGHT_UNIT) * $product['quantity'];
}
}
for ($i = 1; $i <= $this->num_zones; $i++) {
$countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}
if ($dest_zone == 0) {
$error = true;
} else {
$shipping = -1;
$zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
$zones_table = preg_split("/[:,]/", $zones_cost);
$size = sizeof($zones_table);
for ($i = 0; $i < $size; $i += 2) {
if ($shipping_weight <= $zones_table[$i]) {
$shipping = $zones_table[$i + 1];
$shipping_method = __('shipping_zones_method') . ' ' . $dest_country . ' : ' . $osC_Weight->display($osC_ShoppingCart->getWeight(), MODULE_SHIPPING_ZONES_WEIGHT_UNIT);
break;
}
}
if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = __('shipping_zones_undefined_rate');
} else {
$shipping_cost = $shipping * $osC_ShoppingCart->numberOfShippingBoxes() + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
}
}
$this->quotes = array('id' => $this->_code, 'module' => $this->_title, 'methods' => array(array('id' => $this->_code, 'title' => $shipping_method, 'cost' => $shipping_cost)), 'tax_class_id' => $this->tax_class);
if (!empty($this->icon)) {
$this->quotes['icon'] = osc_image($this->icon, $this->_title);
}
if ($error == true) {
$this->quotes['error'] = __('shipping_zones_invalid_zone');
}
return $this->quotes;
}
示例13: initialize
function initialize()
{
global $osC_Language, $osC_Template, $toC_Compare_Products;
if ($toC_Compare_Products->hasContents()) {
$osC_Template->addStyleSheet('ext/multibox/multibox.css');
$osC_Template->addJavascriptFilename('ext/multibox/Overlay.js');
$osC_Template->addJavascriptFilename('ext/multibox/MultiBox.js');
$this->_content = '<ul>';
foreach ($toC_Compare_Products->getProducts() as $products_id) {
$osC_Product = new osC_Product($products_id);
$cid = $products_id;
$str_variants = '';
//if the product have any variants, it means that the $products_id should be a product string such as 1#1:1;2:2
if ($osC_Product->hasVariants()) {
$variants = $osC_Product->getVariants();
if (preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)+$/', $products_id)) {
$products_variant = $variants[$products_id];
} else {
$products_variant = $osC_Product->getDefaultVariant();
}
//if the product have any variants, get the group_name:value_name string
if (isset($products_variant) && isset($products_variant['groups_name']) && is_array($products_variant['groups_name']) && !empty($products_variant['groups_name'])) {
$str_variants .= ' -- ';
foreach ($products_variant['groups_name'] as $groups_name => $value_name) {
$str_variants .= '<strong>' . $groups_name . ': ' . $value_name . '</strong>;';
}
//clean the last ';'
if (($pos = strrpos($str_variants, ';')) !== false) {
$str_variants = substr($str_variants, 0, -1);
}
}
//build the product string that could be used
if (strpos($products_id, '#') !== false) {
$cid = str_replace('#', '_', $products_id);
}
}
$this->_content .= '<li>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), 'cid=' . $cid . '&' . osc_get_all_get_params(array('cid', 'action')) . '&action=compare_products_remove'), osc_draw_image_button('button_delete_icon.png', $osC_Language->get('button_delete')), 'style="float: right; margin: 0 3px 1px 3px"') . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Product->getTitle() . $str_variants) . '</li>';
}
$this->_content .= '</ul>';
$this->_content .= '<p>' . '<span style="float: right">' . osc_link_object(osc_href_link(FILENAME_JSON, 'module=products&action=compare_products'), osc_draw_image_button('small_compare_now.png', $osC_Language->get('button_compare_now')), 'class="multibox" rel="ajax:true"') . '</span>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=compare_products_clear'), osc_draw_image_button('small_clear.png', $osC_Language->get('button_clear'))) . ' ' . '</p>';
$js .= '<script type="text/javascript">
window.addEvent("domready",function() {
var box = new MultiBox(\'multibox\', {
movieWidth: 820,
movieHeight: 600
});
});
</script>';
$this->_content .= "\n" . $js;
}
}
示例14: initialize
function initialize()
{
global $osC_Language, $toC_Compare_Products;
if ($toC_Compare_Products->hasContents()) {
$this->_content = '<ul>';
foreach ($toC_Compare_Products->getProducts() as $products_id) {
$osC_Product = new osC_Product($products_id);
$this->_content .= '<li>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $products_id . '&' . osc_get_all_get_params(array('action')) . '&action=compare_products_remove'), osc_draw_image_button('button_delete_icon.png', $osC_Language->get('button_delete')), 'style="float: right; margin: 0 3px 1px 3px"') . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Product->getTitle()) . '</li>';
}
$this->_content .= '</ul>';
$this->_content .= '<p>' . '<span style="float: right">' . osc_link_object('javascript:popupWindow(\'' . osc_href_link(FILENAME_PRODUCTS, 'compare_products') . '\', \'popupWindow\', \'scrollbars=yes\');', osc_draw_image_button('small_compare_now.png', $osC_Language->get('button_compare_now'))) . '</span>' . osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')) . '&action=compare_products_clear'), osc_draw_image_button('small_clear.png', $osC_Language->get('button_clear'))) . ' ' . '</p>';
}
}
示例15: execute
function execute()
{
global $osC_Database, $osC_Session, $osC_NavigationHistory, $osC_Customer;
if (!$osC_Customer->isLoggedOn()) {
$osC_NavigationHistory->setSnapshot();
osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
return false;
}
$notifications = array();
if (isset($_GET['products']) && !empty($_GET['products'])) {
$products_array = explode(';', $_GET['products']);
foreach ($products_array as $product_id) {
if (is_numeric($product_id) && !in_array($product_id, $notifications)) {
$notifications[] = $product_id;
}
}
} else {
$id = false;
foreach ($_GET as $key => $value) {
if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
$id = $key;
}
break;
}
if ($id !== false && osC_Product::checkEntry($id)) {
$osC_Product = new osC_Product($id);
$notifications[] = $osC_Product->getID();
}
}
if (!empty($notifications)) {
foreach ($notifications as $product_id) {
$Qcheck = $osC_Database->query('select products_id from :table_products_notifications where customers_id = :customers_id and products_id = :products_id limit 1');
$Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
$Qcheck->bindInt(':customers_id', $osC_Customer->getID());
$Qcheck->bindInt(':products_id', $product_id);
$Qcheck->execute();
if ($Qcheck->numberOfRows() < 1) {
$Qn = $osC_Database->query('insert into :table_products_notifications (products_id, customers_id, date_added) values (:products_id, :customers_id, :date_added)');
$Qn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS);
$Qn->bindInt(':products_id', $product_id);
$Qn->bindInt(':customers_id', $osC_Customer->getID());
$Qn->bindRaw(':date_added', 'now()');
$Qn->execute();
}
}
}
osc_redirect(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action'))));
}