本文整理汇总了PHP中osC_Product::getKeyword方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_Product::getKeyword方法的具体用法?PHP osC_Product::getKeyword怎么用?PHP osC_Product::getKeyword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osC_Product
的用法示例。
在下文中一共展示了osC_Product::getKeyword方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
global $osC_Session, $osC_ShoppingCart, $osC_Product;
if (!isset($osC_Product)) {
$id = false;
foreach ($_GET as $key => $value) {
if ((is_numeric($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)) {
if ($osC_Product->hasVariants()) {
if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) {
if ($osC_Product->variantExists($_POST['variants'])) {
$osC_ShoppingCart->add($osC_Product->getProductVariantID($_POST['variants']));
} else {
osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()));
return false;
}
} else {
osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()));
return false;
}
} else {
$osC_ShoppingCart->add($osC_Product->getID());
}
}
osc_redirect(osc_href_link(FILENAME_CHECKOUT));
}
示例2: foreach
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';
}
}
示例3: foreach
function osC_Products_Tell_a_friend()
{
global $osC_Services, $osC_Session, $osC_Language, $osC_Breadcrumb, $osC_Customer, $osC_NavigationHistory, $osC_Product;
if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $osC_Customer->isLoggedOn() === false) {
$osC_NavigationHistory->setSnapshot();
osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
}
$counter = 0;
foreach ($_GET as $key => $value) {
$counter++;
if ($counter < 2) {
continue;
}
if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
if (osC_Product::checkEntry($key) === false) {
$this->_page_title = $osC_Language->get('product_not_found_heading');
$this->_page_contents = 'info_not_found.php';
} else {
$osC_Product = new osC_Product($key);
$this->_page_title = $osC_Product->getTitle();
if ($osC_Services->isStarted('breadcrumb')) {
$osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()));
$osC_Breadcrumb->add($osC_Language->get('breadcrumb_tell_a_friend'), osc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $osC_Product->getKeyword()));
}
if (isset($_GET['action']) && $_GET['action'] == 'process') {
$this->_process();
}
}
break;
}
}
if ($counter < 2) {
$this->_page_title = $osC_Language->get('product_not_found_heading');
$this->_page_contents = 'info_not_found.php';
}
}
示例4: initialize
function initialize()
{
global $osC_Database, $osC_Language, $osC_Currencies;
$Qupcoming = $osC_Database->query('select p.products_id, pa.value as date_expected from :table_products p, :table_templates_boxes tb, :table_product_attributes pa where tb.code = :code and tb.id = pa.id and to_days(str_to_date(pa.value, "%Y-%m-%d")) >= to_days(now()) and pa.products_id = p.products_id and p.products_status = :products_status order by pa.value limit :max_display_upcoming_products');
$Qupcoming->bindTable(':table_products', TABLE_PRODUCTS);
$Qupcoming->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
$Qupcoming->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
$Qupcoming->bindValue(':code', 'date_available');
$Qupcoming->bindInt(':products_status', 1);
$Qupcoming->bindInt(':max_display_upcoming_products', MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY);
if (MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE > 0) {
$Qupcoming->setCache('upcoming_products-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode(), MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE);
}
$Qupcoming->execute();
if ($Qupcoming->numberOfRows() > 0) {
$this->_content = '<ol style="list-style: none;">';
while ($Qupcoming->next()) {
$osC_Product = new osC_Product($Qupcoming->valueInt('products_id'));
$this->_content .= '<li>' . osC_DateTime::getLong($Qupcoming->value('date_expected')) . ': ' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()), $osC_Product->getTitle()) . ' ' . $osC_Product->getPriceFormated(true) . '</li>';
}
$this->_content .= '</ol>';
}
$Qupcoming->freeResult();
}
示例5: getProducts
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;
}
示例6: add
//.........这里部分代码省略.........
$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();
}
}
示例7: foreach
function osC_Products_Reviews()
{
global $osC_Services, $osC_Session, $osC_Language, $osC_Breadcrumb, $osC_Product, $osC_Customer, $osC_NavigationHistory;
if ($osC_Services->isStarted('reviews') === false) {
osc_redirect(osc_href_link(FILENAME_DEFAULT));
}
$this->_page_title = $osC_Language->get('reviews_heading');
if ($osC_Services->isStarted('breadcrumb')) {
$osC_Breadcrumb->add($osC_Language->get('breadcrumb_reviews'), osc_href_link(FILENAME_PRODUCTS, $this->_module));
}
if (is_numeric($_GET[$this->_module])) {
if (osC_Reviews::exists($_GET[$this->_module])) {
$osC_Product = new osC_Product(osC_Reviews::getProductID($_GET[$this->_module]));
$this->_page_title = $osC_Product->getTitle();
$this->_page_contents = 'reviews_info.php';
if ($osC_Services->isStarted('breadcrumb')) {
$osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $this->_module . '=' . $_GET[$this->_module]));
}
} else {
$this->_page_contents = 'reviews_not_found.php';
}
} else {
$counter = 0;
foreach ($_GET as $key => $value) {
$counter++;
if ($counter < 2) {
continue;
}
if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
if (osC_Product::checkEntry($key) === false) {
$this->_page_contents = 'info_not_found.php';
} elseif ($_GET[$this->_module] == 'new') {
if ($osC_Customer->isLoggedOn() === false && SERVICE_REVIEW_ENABLE_REVIEWS == 1) {
$osC_NavigationHistory->setSnapshot();
osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
}
$osC_Product = new osC_Product($key);
$this->_page_title = $osC_Product->getTitle();
$this->_page_contents = 'reviews_new.php';
$this->addJavascriptPhpFilename('templates/' . $this->getCode() . '/javascript/products/reviews_new.php');
if ($osC_Services->isStarted('breadcrumb')) {
$osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $osC_Product->getKeyword()));
$osC_Breadcrumb->add($osC_Language->get('breadcrumb_reviews_new'), osc_href_link(FILENAME_PRODUCTS, $this->_module . '=new&' . $osC_Product->getKeyword()));
}
if (isset($_GET['action']) && $_GET['action'] == 'process') {
$this->_process($osC_Product->getID());
}
} else {
$osC_Product = new osC_Product($key);
$this->_page_title = $osC_Product->getTitle();
$this->_page_contents = 'product_reviews.php';
if ($osC_Services->isStarted('breadcrumb')) {
$osC_Breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $this->_module . '&' . $osC_Product->getKeyword()));
}
}
}
break;
}
if ($counter < 2) {
if (osC_Reviews::exists() === false) {
$this->_page_contents = 'reviews_not_found.php';
}
}
}
}
示例8: foreach
function _getShoppingCart()
{
global $osC_ShoppingCart, $osC_Currencies, $osC_Language, $osC_Customer;
//when the language is changed, it is necessary to update the shopping cart
if (isset($_SESSION['language_change']) && $_SESSION['language_change'] == true) {
if ($osC_Customer->isLoggedOn()) {
$osC_ShoppingCart->reset();
$osC_ShoppingCart->synchronizeWithDatabase();
} else {
foreach ($osC_ShoppingCart->getProducts() as $products_id_string => $data) {
$osC_Product = new osC_Product($products_id_string);
$data['name'] = $osC_Product->getTitle();
$data['keyword'] = $osC_Product->getKeyword();
$_SESSION['osC_ShoppingCart_data']['contents'][$products_id_string] = $data;
}
$osC_ShoppingCart->_calculate();
}
unset($_SESSION['language_change']);
}
$cart = array();
//products
$products = array();
foreach ($osC_ShoppingCart->getProducts() as $products_id => $data) {
$product = array('id' => $products_id, 'link' => osc_href_link(FILENAME_PRODUCTS, osc_get_product_id($products_id)), 'name' => substr($data['name'], 0, self::PRODUCTS_NAME_LENGTH) . (strlen($data['name']) > self::PRODUCTS_NAME_LENGTH ? '..' : ''), 'title' => $data['name'], 'quantity' => $data['quantity'] . ' x ', 'price' => $osC_Currencies->displayPrice($data['price'], $data['tax_class_id'], $data['quantity']));
//variants
if (is_array($data['variants']) && !empty($data['variants'])) {
$product['variants'] = array_values($data['variants']);
}
//customizations
if (is_array($data['customizations']) && !empty($data['customizations'])) {
$product['customizations'] = array_values($data['customizations']);
}
//gift certificate
if ($data['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
$gc_data = $osC_Language->get('senders_name') . ': ' . $data['gc_data']['senders_name'];
if ($data['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
$gc_data .= '<br />- ' . $osC_Language->get('senders_email') . ': ' . $data['gc_data']['senders_email'];
}
$gc_data .= '<br />- ' . $osC_Language->get('recipients_name') . ': ' . $data['gc_data']['recipients_name'];
if ($data['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
$gc_data .= '<br />- ' . $osC_Language->get('recipients_email') . ': ' . $data['gc_data']['recipients_email'];
}
$gc_data .= '<br />- ' . $osC_Language->get('message') . ': ' . $data['gc_data']['message'];
$product['gc_data'] = $gc_data;
}
$products[] = $product;
}
$cart['products'] = $products;
//order totals
$order_totals = array();
foreach ($osC_ShoppingCart->getOrderTotals() as $module) {
$order_totals[] = array('title' => $module['title'], 'text' => $module['text']);
}
$cart['orderTotals'] = $order_totals;
//numberOfItems
$cart['numberOfItems'] = $osC_ShoppingCart->numberOfItems();
//cart total
$cart['total'] = $osC_Currencies->format($osC_ShoppingCart->getTotal());
return $cart;
}
示例9: while
$rows = 0;
while ($Qlisting->next()) {
$osC_Product = new osC_Product($Qlisting->valueInt('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 = '';
switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$lc_align = '';
$lc_text = ' ' . $osC_Product->getModel() . ' ';
break;
case 'PRODUCT_LIST_NAME':
$lc_align = '';
if (isset($_GET['manufacturers'])) {
$lc_text = osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword() . '&manufacturers=' . $_GET['manufacturers']), $osC_Product->getTitle());
} else {
$lc_text = ' ' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword() . ($cPath ? '&cPath=' . $cPath : '')), $osC_Product->getTitle()) . ' ';
}
break;
case 'PRODUCT_LIST_MANUFACTURER':
$lc_align = '';
$lc_text = ' ';
if ($osC_Product->hasManufacturer()) {
$lc_text = ' ' . osc_link_object(osc_href_link(FILENAME_DEFAULT, 'manufacturers=' . $osC_Product->getManufacturerID()), $osC_Product->getManufacturer()) . ' ';
}
break;
case 'PRODUCT_LIST_PRICE':
$lc_align = 'right';
$lc_text = ' ' . $osC_Product->getPriceFormated() . ' ';
break;
示例10: while
$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"> </td>