本文整理汇总了PHP中osCommerce\OM\Core\Registry::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::exists方法的具体用法?PHP Registry::exists怎么用?PHP Registry::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osCommerce\OM\Core\Registry
的用法示例。
在下文中一共展示了Registry::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValid
public static function isValid(Product $OSCOM_Product)
{
$OSCOM_Customer = Registry::get('Customer');
$OSCOM_ShoppingCart = Registry::get('ShoppingCart');
if ($OSCOM_ShoppingCart->hasBillingAddress() === false) {
if ($OSCOM_Customer->hasDefaultAddress()) {
$OSCOM_ShoppingCart->setBillingAddress($OSCOM_Customer->getDefaultAddressID());
$OSCOM_ShoppingCart->resetBillingMethod();
} elseif ($OSCOM_ShoppingCart->hasShippingAddress()) {
$OSCOM_ShoppingCart->setBillingAddress($OSCOM_ShoppingCart->getShippingAddress());
$OSCOM_ShoppingCart->resetBillingMethod();
}
}
if ($OSCOM_ShoppingCart->hasBillingMethod() === false) {
if (Registry::exists('Payment') === false) {
Registry::set('Payment', new Payment());
}
$OSCOM_Payment = Registry::get('Payment');
$OSCOM_Payment->loadAll();
if ($OSCOM_Payment->hasActive()) {
$payment_modules = $OSCOM_Payment->getActive();
$payment_module = $payment_modules[0];
$OSCOM_PaymentModule = Registry::get('Payment_' . $payment_module);
$OSCOM_ShoppingCart->setBillingMethod(array('id' => $OSCOM_PaymentModule->getCode(), 'title' => $OSCOM_PaymentModule->getMethodTitle()));
}
}
return $OSCOM_ShoppingCart->hasBillingAddress() && $OSCOM_ShoppingCart->hasBillingMethod();
}
示例2: initialize
public function initialize()
{
$OSCOM_Product = Registry::exists('Product') ? Registry::get('Product') : null;
$OSCOM_PDO = Registry::get('PDO');
$OSCOM_Language = Registry::get('Language');
if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
$Qmanufacturer = $OSCOM_PDO->query('select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from :table_manufacturers m left join :table_manufacturers_info mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = :languages_id), :table_products p where p.products_id = :products_id and p.manufacturers_id = m.manufacturers_id');
$Qmanufacturer->bindInt(':languages_id', $OSCOM_Language->getID());
$Qmanufacturer->bindInt(':products_id', $OSCOM_Product->getID());
$Qmanufacturer->execute();
$result = $Qmanufacturer->fetch();
if (!empty($result)) {
$this->_content = '';
if (strlen($result['manufacturers_image']) > 0) {
$this->_content .= '<div style="text-align: center;">' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), HTML::image('public/manufacturers/' . $result['manufacturers_image'], $result['manufacturers_name'])) . '</div>';
}
$this->_content .= '<ol style="list-style: none; margin: 0; padding: 0;">';
if (strlen($result['manufacturers_url']) > 0) {
$this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Redirct', 'Manufacturer=' . $result['manufacturers_id']), sprintf(OSCOM::getDef('box_manufacturer_info_website'), $result['manufacturers_name']), 'target="_blank"') . '</li>';
}
$this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), OSCOM::getDef('box_manufacturer_info_products')) . '</li>';
$this->_content .= '</ol>';
}
}
}
示例3: initialize
public function initialize()
{
$OSCOM_Product = Registry::exists('Product') ? Registry::get('Product') : null;
$OSCOM_Customer = Registry::get('Customer');
$OSCOM_Database = Registry::get('Database');
$OSCOM_Language = Registry::get('Language');
$this->_title_link = OSCOM::getLink(null, 'Account', 'Notifications', 'SSL');
if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
if ($OSCOM_Customer->isLoggedOn()) {
$Qcheck = $OSCOM_Database->query('select global_product_notifications from :table_customers where customers_id = :customers_id');
$Qcheck->bindInt(':customers_id', $OSCOM_Customer->getID());
$Qcheck->execute();
if ($Qcheck->valueInt('global_product_notifications') === 0) {
$Qcheck = $OSCOM_Database->query('select products_id from :table_products_notifications where products_id = :products_id and customers_id = :customers_id limit 1');
$Qcheck->bindInt(':products_id', $OSCOM_Product->getID());
$Qcheck->bindInt(':customers_id', $OSCOM_Customer->getID());
$Qcheck->execute();
if ($Qcheck->numberOfRows() > 0) {
$this->_content = '<div style="float: left; width: 55px;">' . osc_link_object(OSCOM::getLink(null, null, osc_get_all_get_params(array('action')) . '&action=notify_remove', 'AUTO'), osc_image(DIR_WS_IMAGES . 'box_products_notifications_remove.gif', sprintf(OSCOM::getDef('box_product_notifications_remove'), $OSCOM_Product->getTitle()))) . '</div>' . osc_link_object(OSCOM::getLink(null, null, osc_get_all_get_params(array('action')) . '&action=notify_remove', 'AUTO'), sprintf(OSCOM::getDef('box_product_notifications_remove'), $OSCOM_Product->getTitle()));
} else {
$this->_content = '<div style="float: left; width: 55px;">' . osc_link_object(OSCOM::getLink(null, null, osc_get_all_get_params(array('action')) . '&action=notify_add', 'AUTO'), osc_image(DIR_WS_IMAGES . 'box_products_notifications.gif', sprintf(OSCOM::getDef('box_product_notifications_add'), $OSCOM_Product->getTitle()))) . '</div>' . osc_link_object(OSCOM::getLink(null, null, osc_get_all_get_params(array('action')) . '&action=notify_add', 'AUTO'), sprintf(OSCOM::getDef('box_product_notifications_add'), $OSCOM_Product->getTitle()));
}
$this->_content .= '<div style="clear: both;"></div>';
}
}
}
}
示例4: execute
public static function execute(ApplicationAbstract $application)
{
$OSCOM_Shipping = Registry::get('Shipping');
$OSCOM_ShoppingCart = Registry::get('ShoppingCart');
if (!empty($_POST['comments'])) {
$_SESSION['comments'] = HTML::sanitize($_POST['comments']);
}
if ($OSCOM_Shipping->hasQuotes()) {
if (isset($_POST['shipping_mod_sel']) && strpos($_POST['shipping_mod_sel'], '_')) {
list($module, $method) = explode('_', $_POST['shipping_mod_sel']);
if (Registry::exists('Shipping_' . $module) && Registry::get('Shipping_' . $module)->isEnabled()) {
$quote = $OSCOM_Shipping->getQuote($_POST['shipping_mod_sel']);
if (isset($quote['error'])) {
$OSCOM_ShoppingCart->resetShippingMethod();
} else {
$OSCOM_ShoppingCart->setShippingMethod($quote);
OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
}
} else {
$OSCOM_ShoppingCart->resetShippingMethod();
}
}
} else {
$OSCOM_ShoppingCart->resetShippingMethod();
OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
}
}
示例5: initialize
public function initialize()
{
if (Registry::exists('Product')) {
$OSCOM_PDO = Registry::get('PDO');
$OSCOM_Product = Registry::get('Product');
$OSCOM_Language = Registry::get('Language');
$OSCOM_Image = Registry::get('Image');
$Qorders = $OSCOM_PDO->prepare('select p.products_id, pd.products_name, pd.products_keyword, i.image from :table_orders_products opa, :table_orders_products opb, :table_orders o, :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 opa.products_id = :products_id and opa.orders_id = opb.orders_id and opb.products_id != :products_id and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id group by p.products_id order by o.date_purchased desc limit :limit');
$Qorders->bindInt(':default_flag', 1);
$Qorders->bindInt(':products_id', $OSCOM_Product->getID());
$Qorders->bindInt(':products_id', $OSCOM_Product->getID());
$Qorders->bindInt(':language_id', $OSCOM_Language->getID());
$Qorders->bindInt(':limit', MODULE_CONTENT_ALSO_PURCHASED_MAX_DISPLAY);
if (MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE > 0) {
$Qorders->setCache('also_purchased-' . $OSCOM_Product->getID(), MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE);
}
$Qorders->execute();
$result = $Qorders->fetchAll();
if (count($result) >= MODULE_CONTENT_ALSO_PURCHASED_MIN_DISPLAY) {
$this->_content = '<div style="overflow: auto;">';
foreach ($result as $p) {
$this->_content .= '<span style="width: 33%; float: left; text-align: center;">';
if (strlen($p['image']) > 0) {
$this->_content .= HTML::link(OSCOM::getLink(null, 'Products', $p['products_keyword']), $OSCOM_Image->show($p['image'], $p['products_name'])) . '<br />';
}
$this->_content .= HTML::link(OSCOM::getLink(null, 'Products', $p['products_keyword']), $p['products_name']) . '</span>';
}
$this->_content .= '</div>';
}
}
}
示例6: execute
public static function execute($search, $parent_id = 0)
{
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
$OSCOM_CategoryTree->reset();
$OSCOM_CategoryTree->setRootCategoryID($parent_id);
$OSCOM_CategoryTree->setBreadcrumbUsage(false);
$categories = array();
foreach ($OSCOM_CategoryTree->getArray() as $c) {
if (stripos($c['title'], $search) !== false) {
if ($c['id'] != $parent_id) {
$category_path = $OSCOM_CategoryTree->getPathArray($c['id']);
$top_category_id = $category_path[0]['id'];
if (!in_array($top_category_id, $categories)) {
$categories[] = $top_category_id;
}
}
}
}
$result = array('entries' => array());
foreach ($categories as $c) {
$result['entries'][] = array('id' => $OSCOM_CategoryTree->getData($c, 'id'), 'title' => $OSCOM_CategoryTree->getData($c, 'name'), 'products' => $OSCOM_CategoryTree->getData($c, 'count'));
}
$result['total'] = count($result['entries']);
return $result;
}
示例7: initialize
public function initialize()
{
if (Registry::exists('Product')) {
$OSCOM_Database = Registry::get('Database');
$OSCOM_Product = Registry::get('Product');
$OSCOM_Language = Registry::get('Language');
$OSCOM_Image = Registry::get('Image');
$Qorders = $OSCOM_Database->query('select p.products_id, pd.products_name, pd.products_keyword, i.image from :table_orders_products opa, :table_orders_products opb, :table_orders o, :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 opa.products_id = :products_id and opa.orders_id = opb.orders_id and opb.products_id != :products_id and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id group by p.products_id order by o.date_purchased desc limit :limit');
$Qorders->bindInt(':default_flag', 1);
$Qorders->bindInt(':products_id', $OSCOM_Product->getID());
$Qorders->bindInt(':products_id', $OSCOM_Product->getID());
$Qorders->bindInt(':language_id', $OSCOM_Language->getID());
$Qorders->bindInt(':limit', MODULE_CONTENT_ALSO_PURCHASED_MAX_DISPLAY);
if (MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE > 0) {
$Qorders->setCache('also_purchased-' . $OSCOM_Product->getID(), MODULE_CONTENT_ALSO_PURCHASED_PRODUCTS_CACHE);
}
$Qorders->execute();
if ($Qorders->numberOfRows() >= MODULE_CONTENT_ALSO_PURCHASED_MIN_DISPLAY) {
$this->_content = '<div style="overflow: auto;">';
while ($Qorders->next()) {
$this->_content .= '<span style="width: 33%; float: left; text-align: center;">';
if (strlen($Qorders->value('image')) > 0) {
$this->_content .= osc_link_object(OSCOM::getLink(null, 'Products', $Qorders->value('products_keyword')), $OSCOM_Image->show($Qorders->value('image'), $Qorders->value('products_name'))) . '<br />';
}
$this->_content .= osc_link_object(OSCOM::getLink(null, 'Products', $Qorders->value('products_keyword')), $Qorders->value('products_name')) . '</span>';
}
$this->_content .= '</div>';
}
$Qorders->freeResult();
}
}
示例8: process
protected function process()
{
$OSCOM_ShoppingCart = Registry::get('ShoppingCart');
$OSCOM_Customer = Registry::get('Customer');
$OSCOM_Language = Registry::get('Language');
$OSCOM_Service = Registry::get('Service');
$OSCOM_Breadcrumb = Registry::get('Breadcrumb');
$OSCOM_MessageStack = Registry::get('MessageStack');
// redirect to shopping cart if shopping cart is empty
if (!$OSCOM_ShoppingCart->hasContents()) {
osc_redirect(OSCOM::getLink(null, 'Cart'));
}
// check for e-mail address
if (!$OSCOM_Customer->hasEmailAddress()) {
if (isset($_POST['email']) && strlen(trim($_POST['email'])) >= ACCOUNT_EMAIL_ADDRESS) {
if (osc_validate_email_address($_POST['email'])) {
$OSCOM_Customer->setEmailAddress(trim($_POST['email']));
} else {
$OSCOM_MessageStack->add('Cart', OSCOM::getDef('field_customer_email_address_check_error'));
osc_redirect(OSCOM::getLink(null, 'Cart'));
}
} else {
$OSCOM_MessageStack->add('Cart', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS));
osc_redirect(OSCOM::getLink(null, 'Cart'));
}
}
// check product type perform_order conditions
foreach ($OSCOM_ShoppingCart->getProducts() as $product) {
$OSCOM_Product = new Product($product['id']);
$OSCOM_Product->isTypeActionAllowed('PerformOrder');
}
$OSCOM_Language->load('checkout');
$OSCOM_Language->load('order');
$this->_page_title = OSCOM::getDef('confirmation_heading');
if ($OSCOM_Service->isStarted('Breadcrumb')) {
$OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_checkout_confirmation'), OSCOM::getLink(null, 'Checkout', null, 'SSL'));
}
if (isset($_POST['comments']) && isset($_SESSION['comments']) && empty($_POST['comments'])) {
unset($_SESSION['comments']);
} elseif (!empty($_POST['comments'])) {
$_SESSION['comments'] = osc_sanitize_string($_POST['comments']);
}
if (DISPLAY_CONDITIONS_ON_CHECKOUT == '1') {
if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') {
$OSCOM_MessageStack->add('Checkout', OSCOM::getDef('error_conditions_not_accepted'), 'error');
}
}
if (Registry::exists('Payment') === false) {
Registry::set('Payment', new Payment());
}
if ($OSCOM_ShoppingCart->hasBillingMethod()) {
$OSCOM_Payment = Registry::get('Payment');
$OSCOM_Payment->load($OSCOM_ShoppingCart->getBillingMethod('id'));
}
}
示例9: execute
public static function execute() {
if ( !Registry::exists('Currencies') ) {
Registry::set('Currencies', new Currencies());
}
$OSCOM_Currencies = Registry::get('Currencies');
$result = array('value' => $OSCOM_Currencies->format($_GET['value']),
'rpcStatus' => RPC::STATUS_SUCCESS);
echo json_encode($result);
}
示例10: execute
public static function execute($id)
{
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
$data = $OSCOM_CategoryTree->getData($id);
if (!empty($data['image']) && file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $data['image'])) {
unlink(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $data['image']);
}
}
示例11: execute
public static function execute($parent_id = 0)
{
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
$OSCOM_CategoryTree->reset();
$OSCOM_CategoryTree->setMaximumLevel(1);
$OSCOM_CategoryTree->setBreadcrumbUsage(false);
$result = $OSCOM_CategoryTree->getArray($parent_id);
foreach ($result as &$c) {
$c['products'] = $OSCOM_CategoryTree->getData($c['id'], 'count');
}
return array('entries' => $result, 'total' => count($result));
}
示例12: initialize
function initialize()
{
$OSCOM_Category = Registry::get('Category');
if (SERVICE_RECENTLY_VISITED_SHOW_PRODUCTS == '1') {
if (Registry::exists('Product') && Registry::get('Product') instanceof Product) {
$this->setProduct(Registry::get('Product')->getMasterID());
}
}
if (SERVICE_RECENTLY_VISITED_SHOW_CATEGORIES == '1' && $OSCOM_Category->getID() > 0) {
$this->setCategory($OSCOM_Category->getID());
}
if (SERVICE_RECENTLY_VISITED_SHOW_SEARCHES == '1') {
if (Registry::exists('Search') && Registry::get('Search') instanceof Search && Registry::get('Search')->hasKeywords()) {
$this->setSearchQuery(Registry::get('Search')->getKeywords());
}
}
}
示例13: execute
public static function execute($id)
{
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
$data = array('id' => $id);
foreach (array_merge(array($data['id']), $OSCOM_CategoryTree->getChildren($data['id'])) as $c) {
Categories::deleteImage($c);
}
if (OSCOM::callDB('Admin\\Categories\\Delete', $data)) {
Cache::clear('categories');
Cache::clear('category_tree');
Cache::clear('also_purchased');
return true;
}
return false;
}
示例14: execute
public static function execute($id, $key = null, $language_id = null)
{
$OSCOM_Language = Registry::get('Language');
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
if (!isset($language_id)) {
$language_id = $OSCOM_Language->getID();
}
$data = array('id' => $id, 'language_id' => $language_id);
$result = OSCOM::callDB('Admin\\Categories\\Get', $data);
$result['children_count'] = count($OSCOM_CategoryTree->getChildren($id));
$result['product_count'] = $OSCOM_CategoryTree->getNumberOfProducts($id);
if (isset($key)) {
$result = $result[$key] ?: null;
}
return $result;
}
示例15: execute
public static function execute($id = null, $data)
{
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
if (is_numeric($id)) {
$data['id'] = $id;
}
// Prevent another big bang and check if category is not being moved to a child category
if (isset($data['id']) && $OSCOM_CategoryTree->getParentID($data['id']) != $data['parent_id']) {
if (in_array($data['id'], explode('_', $OSCOM_CategoryTree->buildBreadcrumb($data['parent_id'])))) {
return false;
}
}
if (isset($data['image'])) {
$new_image = $data['image'];
while (file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $new_image)) {
$new_image = rand(10, 99) . $new_image;
}
if (rename(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload/' . $data['image'], OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $new_image)) {
if (is_numeric($id)) {
$old_image = Categories::get($id, 'categories_image');
unlink(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $old_image);
}
$data['image'] = $new_image;
} else {
$data['image'] = null;
}
}
if (OSCOM::callDB('Admin\\Categories\\Save', $data)) {
Cache::clear('categories');
Cache::clear('category_tree');
Cache::clear('also_purchased');
return true;
}
return false;
}