本文整理汇总了PHP中JeproshopContext类的典型用法代码示例。如果您正苦于以下问题:PHP JeproshopContext类的具体用法?PHP JeproshopContext怎么用?PHP JeproshopContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JeproshopContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addShopRestriction
public static function addShopRestriction($shop = NULL, $alias = NULL)
{
$context = JeproshopContext::getContext();
if (!empty($alias)) {
$alias .= '.';
}
/** If there is no shop id, get the context one **/
if ($shop === null) {
if (JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_GROUP) {
$shop_group = JeproshopShopModelShop::getContextShopGroup();
} else {
$shop_group = $context->shop->getShopGroup();
}
$shop = $context->shop;
} elseif (is_object($shop)) {
$shop_group = $shop->getShopGroup();
} else {
$shop = new JeproshopShopModelShop($shop);
$shop_group = $shop->getShopGroup();
}
/* if quantities are shared between shops of the group */
$db = JFactory::getDBO();
if ($shop_group->share_stock) {
$query = " AND " . $db->escape($alias) . "shop_group_id = " . (int) $shop_group->shop_group_id . " AND " . $db->escape($alias) . "shop_id = 0 ";
} else {
$query = " AND " . $db->escape($alias) . "shop_id = " . (int) $shop->shop_id . ' ';
}
return $query;
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:29,代码来源:stock.php
示例2: display
public function display($tpl = null)
{
if (!isset($this->context) || $this->context == null) {
$this->context = JeproshopContext::getContext();
}
if (!$this->context->controller->isInitialized()) {
$this->context->controller->initialize();
}
$app = JFactory::getApplication();
$useSSL = isset($this->context->controller->ssl_enabled) && $this->context->conteoller->ssl_enabled && $app->input->get('enable_ssl') || JeproshopTools::usingSecureMode() ? true : false;
$protocol_content = $useSSL ? 'https://' : 'http://';
/*$contextParams = $this->context->controller->getContextParams();
foreach ($contextParams as $assign_key => $assign_value){
if (!is_array($assign_value) && mb_substr($assign_value, 0, 1, 'utf-8') == '/' || $protocol_content == 'https://'){
$this->assignRef($assign_key, $protocol_content.JeproshopTools::getMediaServer($assign_value).$assign_value);
}else{
$this->assignRef($assign_key, $assign_value);
}
}*/
if (!isset(self::$cache_products)) {
$category = new JeproshopCategoryModelCategory(JeproshopContext::getContext()->shop->getCategoryId(), (int) JeproshopContext::getContext()->language->lang_id);
$nb = (int) JeproshopSettingModelSetting::getValue('number_of_products_on_page');
self::$cache_products = JeproshopDefaultModelDefault::getProducts((int) JeproshopContext::getContext()->language->lang_id, 0, $nb ? $nb : 8, 'position');
}
if (self::$cache_products === false || empty(self::$cache_products)) {
self::$cache_products = false;
}
$this->assignRef('products', self::$cache_products);
$display_add_product = JeproshopSettingModelSetting::getValue('display_category_attribute');
$this->assignRef('display_add_product', $display_add_product);
$homeSize = JeproshopImageModelImage::getSize(JeproshopImageTypeModelImageType::getFormatName('home'));
$this->assignRef('homeSize', $homeSize);
$this->assignRef('pagination', JeproshopDefaultModelDefault::$_pagination);
parent::display($tpl);
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:35,代码来源:view.html.php
示例3: renderEditForm
public function renderEditForm($tpl = null)
{
$helper = new JeproshopHelper();
$this->assignRef('helper', $helper);
$tax_rules_groups = JeproshopTaxRulesGroupModelTaxRulesGroup::getTaxRulesGroups(true);
$this->assignRef('tax_rules_groups', $tax_rules_groups);
$carrier_logo = JeproshopTools::isLoadedObject($this->carrier, 'carrier_id') && file_exists(COM_JEPROSHOP_CARRIER_IMAGE_DIR . $this->carrier->carrier_id . '.jpg') ? COM_JEPROSHOP_CARRIER_IMAGE_DIR . $this->carrier->carrier_id . '.jpg' : false;
$this->assignRef('carrier_logo', $carrier_logo);
$groups = JeproshopGroupModelGroup::getGroups(JeproshopContext::getContext()->language->lang_id);
$this->assignRef('groups', $groups);
$zones = JeproshopZoneModelZone::getZones();
$this->assignRef('zones', $zones);
$carrierZones = $this->carrier->getZones();
$carrier_zones_ids = array();
if (is_array($carrierZones)) {
foreach ($carrierZones as $carrier_zone) {
$carrier_zones_ids[] = $carrier_zone->zone_id;
}
}
$this->assignRef('selected_zones', $carrier_zones_ids);
if ($this->getLayout() != 'modal') {
$this->addToolBar();
$this->sideBar = JHtmlSidebar::render();
}
parent::display($tpl);
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:26,代码来源:view.html.php
示例4: getScenes
/**
* Get all scenes of a category
*
* @param $category_id
* @param null $lang_id
* @param bool $only_published
* @param bool $lite_result
* @param bool $hide_scene_position
* @param JeproshopContext $context
* @return array Products
*/
public static function getScenes($category_id, $lang_id = null, $only_published = true, $lite_result = true, $hide_scene_position = true, JeproshopContext $context = null)
{
if (!JeproshopSceneModelScene::isFeaturePublished()) {
return array();
}
$cache_key = 'jeproshop_scene_get_scenes_' . $category_id . '_' . (int) $lite_result;
if (!JeproshopCache::isStored($cache_key)) {
if (!$context) {
$context = JeproshopContext::getContext();
}
$lang_id = is_null($lang_id) ? $context->language->lang_id : $lang_id;
$db = JFactory::getDBO();
$query = "SELECT scene.* FROM " . $db->quoteName('#__jeproshop_scene_category') . " scene_category LEFT JOIN " . $db->quoteName('#__jeproshop_scene');
$query .= " AS scene ON (scene_category.scene_id = scene.scene_id) " . JeproshopShopModelShop::addSqlAssociation('scene') . " LEFT JOIN ";
$query .= $db->quoteName('#__jeproshop_scene_lang') . " AS scene_lang ON (scene_lang.scene_id = scene.scene_id) WHERE scene_category.category_id = ";
$query .= (int) $category_id . "\tAND scene_lang.lang_id = " . (int) $lang_id . ($only_published ? " AND scene.published = 1" : "") . " ORDER BY scene_lang.name ASC";
$db->setQuery($query);
$scenes = $db->loadObjectList();
if (!$lite_result && $scenes) {
foreach ($scenes as &$scene) {
$scene = new Scene($scene->scene_id, $lang_id, false, $hide_scene_position);
}
}
JeproshopCache::store($cache_key, $scenes);
}
$scenes = JeproshopCache::retrieve($cache_key);
return $scenes;
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:39,代码来源:scene.php
示例5: getWarningDomainName
protected function getWarningDomainName()
{
$warning = false;
if (JeproshopShopModelShop::isFeaturePublished()) {
return null;
}
$shop = JeproshopContext::getContext()->shop;
return $warning;
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:9,代码来源:view.html.php
示例6: renderView
public function renderView($tpl = null)
{
$app = JFactory::getApplication();
$this->context = JeproshopContext::getContext();
$customerList = $this->group->getCustomersList();
$this->assignRef('customers', $customerList);
$categoryReductions = $this->formatCategoryDiscountList($this->group->group_id);
$this->assignRef('category_reductions', $categoryReductions);
$this->addToolBar();
$this->sideBar = JHtmlSidebar::render();
parent::display($tpl);
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:12,代码来源:view.html.php
示例7: addFeatureValue
public function addFeatureValue($tpl = null)
{
if (!isset($this->context)) {
$this->context = JeproshopContext::getContext();
}
$helper = new JeproshopHelper();
$this->assignRef('helper', $helper);
$features = JeproshopFeatureModelFeature::getFeatures($this->context->language->lang_id);
$this->assignRef('features', $features);
$this->addToolBar();
$this->sideBar = JHtmlSideBar::render();
parent::display($tpl);
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:13,代码来源:view.html.php
示例8: getAttributeMinimalQty
/**
* Get minimal quantity for product with attributes quantity
*
* @acces public static
* @param integer $id_product_attribute
* @return mixed Minimal Quantity or false
*/
public static function getAttributeMinimalQty($product_attribute_id)
{
$db = JFactory::getDBO();
$query = "SELECT " . $db->quoteName('minimal_quantity') . " FROM " . $db->quoteName('#__jeproshop_product_attribute_shop') . " AS product_attribute_shop ";
$query .= " WHERE " . $db->quoteName('shop_id') . " = " . (int) JeproshopContext::getContext()->shop->shop_id . " AND " . $db->quoteName('product_attribute_id');
$query .= (int) $product_attribute_id;
$db->setQuery($query);
$minimal_quantity = $db->loaResult();
if ($minimal_quantity > 1) {
return (int) $minimal_quantity;
}
return false;
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:20,代码来源:attribute.php
示例9: initialize
public function initialize()
{
parent::initialize();
$app = JFactory::getApplication();
$context = JeproshopContext::getContext();
// Get address ID
$address_id = 0;
$type = $app->input->get('type');
if ($this->use_ajax && isset($type)) {
if ($type == 'delivery' && isset($context->cart->address_delivery_id)) {
$address_id = (int) $context->cart->address_delivery_id;
} else {
if ($type == 'invoice' && isset($context->cart->address_invoice_id) && $context->cart->id_address_invoice != $context->cart->address_delivery_id) {
$address_id = (int) $context->cart->address_invoice_id;
}
}
} else {
$address_id = (int) $app->input->get('address_id', 0);
}
// Initialize address
if ($address_id) {
$address = new JeproshopAddressModelAddress($address_id);
$view = $app->input->get('view');
$viewClass = $this->getView($view, JFactory::getDocument()->getType());
if (JeproshopTools::isLoadedObject($address, 'address_id') && JeproshopCustomerModelCustomer::customerHasAddress($context->customer->customer_id, $address_id)) {
$task = $app->input->get('task');
if (isset($task) && $task == 'delete') {
if ($address->delete()) {
if ($context->cart->address_invoice_id == $address->address_id) {
unset($context->cart->address_invoice_id);
}
if ($context->cart->id_address_delivery == $address->address_id) {
unset($context->cart->id_address_delivery);
$context->cart->updateAddressId($address->address_id, (int) JeproshopAddressModelAddress::getCustomerFirstAddressId($context->customer->customer_id));
}
$app->redirect('index.php?option=com_jeproshop&view=address');
}
$this->has_errors = true;
JError::raiseError(500, 'This address cannot be deleted.');
}
} elseif ($this->use_ajax) {
$app->close;
} else {
$app->redirect('index.php?option=com_jeproshop&view=address');
}
}
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:47,代码来源:address.php
示例10: addShop
public function addShop($tpl = null)
{
if ($this->context == null) {
$this->context = JeproshopContext::getContext();
}
$display_group_list = true;
if ($display_group_list) {
$shop_groups = JeproshopShopGroupModelShopGroup::getShopGroups();
$this->assignRef('shop_groups', $shop_groups);
}
$categories = JeproshopCategoryModelCategory::getRootCategories($this->context->language->lang_id);
$themes = JeproshopThemeModelTheme::getThemes();
$this->assignRef('themes', $themes);
$this->assignRef('categories', $categories);
$this->addToolBar();
$this->sideBar = JHtmlSidebar::render();
parent::display($tpl);
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:18,代码来源:view.html.php
示例11: assignCountries
/**
* Assign template vars related to countries display
*/
protected function assignCountries()
{
$context = JeproshopContext::getContext();
$app = JFactory::getApplication();
$country_id = $app->input->get('country_id');
// Get selected country
if (isset($country_id) && !is_null($country_id) && is_numeric($country_id)) {
$selected_country = (int) $country_id;
} else {
if (isset($this->address) && isset($this->address->country_id) && !empty($this->address->country_id) && is_numeric($this->address->country_id)) {
$selected_country = (int) $this->address->country_id;
} else {
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
// get all countries as language (xy) or language-country (wz-XY)
$array = array();
preg_match("#(?<=-)\\w\\w|\\w\\w(?!-)#", $_SERVER['HTTP_ACCEPT_LANGUAGE'], $array);
if (!JeproshopTools::isLanguageIsoCode($array[0]) || !($selected_country = JeproshopCountryModelCountry::getByIso($array[0]))) {
$selected_country = (int) JeproshopSettingModelSetting::getValue('default_country');
}
} else {
$selected_country = (int) JeproshopSettingModelSetting::getValue('default_country');
}
}
}
// Generate countries list
if (JeproshopSettingModelSetting::getValue('restrict_delivered_countries')) {
$countries = JeproshopCarrierModelCarrier::getDeliveredCountries($context->language->lang_id, true, true);
} else {
$countries = JeproshopCountryModelCountry::getCountries($context->language->lang_id, true);
}
// @todo use helper
$list = '';
foreach ($countries as $country) {
$selected = $country->country_id == $selected_country ? 'selected="selected"' : '';
$list .= '<option value="' . (int) $country->country_id . '" ' . $selected . '>' . htmlentities(ucfirst($country->name)) . '</option>';
}
// Assign vars
$this->assignRef('countries_list', $list);
$this->assignRef('countries', $countries);
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:43,代码来源:view.html.php
示例12: initialize
public function initialize()
{
$app = JFactory::getApplication();
$context = JeproshopContext::getContext();
parent::initialize();
$category_id = $app->input->get('category_id');
$task = $app->input->get('task');
if ($category_id && $task != 'delete') {
$this->category = new JeproshopCategoryModelCategory($category_id);
} else {
if (JeproshopShopModelShop::isFeaturePublished() && JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP) {
$this->category = new JeproshopCategoryModelCategory($context->shop->category_id);
} elseif (count(JeproshopCategoryModelCategory::getCategoriesWithoutParent()) > 1 && JeproshopSettingModelSetting::getValue('multishop_feature_active') && count(JeproshopShopModelShop::getShops(true, null, true)) != 1) {
$this->category = JeproshopCategoryModelCategory::getTopCategory();
} else {
$this->category = new JeproshopCategoryModelCategory(JeproshopSettingModelSetting::getValue('root_category'));
}
}
if (JeproshopTools::isLoadedObject($this->category, 'category_id') && !$this->category->isAssociatedToShop() && JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP) {
$app->redirect('index.php?option=com_jeproshop&view=category&task=edit&category_id=' . (int) $context->shop->getCategoryId() . '&' . JeproshopTools::getCategoryToken() . '=1');
}
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:22,代码来源:category.php
示例13: getProductWarehouseList
/**
* For a given {product, product attribute} gets warehouse list
*
* @param int $product_id ID of the product
* @param int $product_attribute_id Optional, uses 0 if this product does not have attributes
* @param int $shop_id Optional, ID of the shop. Uses the context shop id (@see JeproshopContext::shop)
* @return array Warehouses (ID, reference/name concatenated)
*/
public static function getProductWarehouseList($product_id, $product_attribute_id = 0, $shop_id = null)
{
$db = JFactory::getDBO();
// if it's a pack, returns warehouses if and only if some products use the advanced stock management
if (JeproshopProductPack::isPack($product_id)) {
$warehouses = JeproshopWarehouseModelWarehouse::getPackWarehouses($product_id);
/*$res = array();
foreach ($warehouses as $warehouse)
$res[]['id_warehouse'] = $warehouse; */
return $warehouses;
}
$share_stock = false;
if ($shop_id === null) {
if (JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_GROUP) {
$shop_group = JeproshopShopModelShop::getContextShopGroup();
} else {
$shop_group = JeproshopContext::getContext()->shop->getShopGroup();
$shop_id = (int) JeproshopContext::getContext()->shop->shop_id;
}
$share_stock = $shop_group->share_stock;
} else {
$shop_group = JeproshopShopModelShop::getGroupFromShop($shop_id);
$share_stock = $shop_group->share_stock;
}
if ($share_stock) {
$shop_ids = JeproshopShopModelShop::getShops(true, (int) $shop_group->shop_group_id, true);
} else {
$shop_ids = array((int) $shop_id);
}
$query = "SELECT warehouse_product_location.warehouse_id, CONCAT(warehouse.reference, ' - ', warehouse.name)";
$query .= " AS name FROM " . $db->QuoteName('#__jeproshop_warehouse_product_location') . " AS warehouse_product_location";
$query .= " INNER JOIN " . $db->quoteName('#__jeproshop_warehouse_shop') . " AS warehouse_shop ON(warehouse_shop.";
$query .= "warehouse_id = warehouse_product_location.warehouse_id AND shop_id IN (" . implode(',', array_map('intval', $shop_ids));
$query .= " )) INNER JOIN " . $db->quoteName('#__jeproshop_warehouse') . " AS warehouse ON (warehouse.warehouse_id = warehouse_shop.";
$query .= "warehouse_id ) WHERE product_id = " . (int) $product_id . " AND product_attribute_id = " . (int) $product_attribute_id;
$query .= " AND warehouse.deleted = 0 GROUP BY warehouse_product_location.warehouse_id";
$db->setQuery($query);
return $db->loadObjectList();
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:47,代码来源:warehouse.php
示例14: thumbnail
/**
* Generate a cached thumbnail for object lists (eg. carrier, order statuses...etc)
*
* @param string $image Real image filename
* @param string $cache_image Cached filename
* @param int $size Desired size
* @param string $image_type Image type
* @param bool $disable_cache When turned on a timestamp will be added to the image URI to disable the HTTP cache
* @param bool $regenerate When turned on and the file already exist, the file will be regenerated
* @return string
*/
public static function thumbnail($image, $cache_image, $size, $image_type = 'jpg', $disable_cache = true, $regenerate = false)
{
if (!file_exists($image)) {
return '';
}
if (file_exists(COM_JEPROSHOP_TMP_IMG_DIR . $cache_image) && $regenerate) {
@unlink(COM_JEPROSHOP_TMP_IMG_DIR . $cache_image);
}
if ($regenerate || !file_exists(COM_JEPROSHOP_TMP_IMG_DIR . $cache_image)) {
$infos = getimagesize($image);
// Evaluate the memory required to resize the image: if it's too much, you can't resize it.
if (!JeproshopImageManager::checkImageMemoryLimit($image)) {
return false;
}
$x = $infos[0];
$y = $infos[1];
$max_x = $size * 3;
// Size is already ok
if ($y < $size && $x <= $max_x) {
copy($image, COM_JEPROSHOP_TMP_IMG_DIR . $cache_image);
// We need to resize */
} else {
$ratio_x = $x / ($y / $size);
if ($ratio_x > $max_x) {
$ratio_x = $max_x;
$size = $y / ($x / $max_x);
}
JeproshopImageManager::resize($image, COM_JEPROSHOP_TMP_IMG_DIR . $cache_image, $ratio_x, $size, $image_type);
}
}
// Relative link will always work, whatever the base uri set in the admin
if (JeproshopContext::getContext()->controller->controller_type == 'admin') {
return '<img src="../img/tmp/' . $cache_image . ($disable_cache ? '?time=' . time() : '') . '" alt="" class="imgm img-thumbnail" />';
} else {
return '<img src="' . _PS_TMP_IMG_ . $cache_image . ($disable_cache ? '?time=' . time() : '') . '" alt="" class="imgm img-thumbnail" />';
}
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:48,代码来源:image.php
示例15: getMessagesByOrderId
/**
* Return messages from Order ID
*
* @param integer $order_id Order ID
* @param boolean $private return WITH private messages
* @param JeproshopContext $context
* @return array Messages
*/
public static function getMessagesByOrderId($order_id, $private = false, JeproshopContext $context = null)
{
if (!JeproshopTools::isBool($private)) {
die(JError::raiseError());
}
if (!$context) {
$context = JeproshopContext::getContext();
}
$db = JFactory::getDBO();
$query = "SELECT message.*, customer." . $db->quoteName('firstname') . " AS customer_firstname, customer.";
$query .= $db->quoteName('lastname') . " AS customer_lastname, employee." . $db->quoteName('name') . " AS employee_name, ";
$query .= "employee." . $db->quoteName('username') . " AS employee_user_name, (COUNT(message_readed.message_id) = 0 AND ";
$query .= "message.customer_id != 0) AS is_new_for_me FROM " . $db->quoteName('#__jeproshop_message') . " AS message LEFT JOIN ";
$query .= $db->quoteName('#__jeproshop_customer') . " AS customer ON message." . $db->quoteName('customer_id') . " = ";
$query .= "customer." . $db->quoteName('customer_id') . " LEFT JOIN " . $db->quoteName('#__jeproshop_message_readed');
$query .= " AS message_readed ON message_readed." . $db->quoteName('message_id') . " = message." . $db->quoteName('message_id');
$query .= " AND message_readed." . $db->quoteName('employee_id') . " = " . (isset($context->employee) ? (int) $context->employee->employee_id : "");
$query .= " LEFT OUTER JOIN " . $db->quoteName('#__users') . " AS employee ON employee." . $db->quoteName('id');
$query .= " = message." . $db->quoteName('employee_id') . "\tWHERE order_id = " . (int) $order_id;
$query .= (!$private ? " AND message." . $db->quoteName('private') . " = 0" : "") . " GROUP BY message.message_id";
$query .= " ORDER BY message.date_add DESC";
$db->setQuery($query);
return $db->loadObjectList();
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:32,代码来源:message.php
示例16: __construct
/**
* Get data if the cookie exists and else initialize an new one
*
* @param String $name
* @param String $path
* @param String $expire
* @param String $shared_urls
*/
public function __construct($name, $path = '', $expire = null, $shared_urls = null)
{
$this->_content = array();
$this->_expire = is_null($expire) ? time() + 1728000 : (int) $expire;
$this->_name = md5(COM_JEPROSHOP_VERSION . $name);
$this->_path = trim(JeproshopContext::getContext()->shop->physical_uri . $path, '/\\') . '/';
if ($this->_path[0] != '/') {
$this->_path = '/' . $this->_path;
}
$this->_path = rawurlencode($this->_path);
$this->_path = str_replace('%2F', '/', $this->_path);
$this->_path = str_replace('%7E', '~', $this->_path);
$this->_key = COM_JEPROSHOP_COOKIE_KEY;
$this->_iv = COM_JEPROSHOP_COOKIE_IV;
$this->_domain = $this->getDomain($shared_urls);
$this->_allow_writing = TRUE;
if (JeproshopSettingModelSetting::getValue('cipher_algorithm')) {
$this->_cipherTool = new Rijndael(COM_JEPROSHOP_RIJNDAEL_KEY, COM_JEPROSHOP_RIJNDAEL_IV);
} else {
$this->_cipherToll = new BlowFish($this->_key, $this->_iv);
}
$this->lang_id = (int) JeproshopSettingModelSetting::getValue('default_lang');
$this->update();
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:32,代码来源:cookie.php
示例17: update_status
public function update_status()
{
$app = JFactory::getApplication();
$order_status_id = $app->input->get('order_status_id');
$order_id = $app->input->get('order_id');
$order = new JeproshopOrderModelOrder($order_id);
$context = JeproshopContext::getContext();
if (!JeproshopTools::isLoadedObject($order, 'order_id')) {
echo '<p>' . JText::_('COM_JEPROSHOP_THE_ORDER_CANNOT_BE_FOUND_WITH_IN_YOUR_DATABASE_MESSAGE') . '</p>';
}
if ($this->viewAccess()) {
$orderStatus = new JeproshopOrderStatusModelOrderStatus($order_status_id);
if (!JeproshopTools::isLoadedObject($orderStatus, 'order_status_id')) {
echo JText::_('COM_JEPROSHOP_THE_ORDER_STATUS_CANNOT_BE_FOUND_WITH_IN_YOUR_DATABASE_MESSAGE');
} else {
$order = new JeproshopOrderModelOrder();
$currentOrderStatus = $order->getCurrentOrderStatus();
if ($currentOrderStatus->order_status_id != $orderStatus) {
// Create a order history
$orderHistory = new JeproshopOrderHistoryModelOrderHistory();
$orderHistory->order_id = $order->order_id;
$orderHistory->employee_id = (int) $context->employee->employee_id;
$useExistingPayment = false;
if (!$order->hasInvoice()) {
$useExistingPayment = true;
}
$orderHistory->changeOrderStatusId((int) $orderStatus->order_status_id, $order, $useExistingPayment);
$carrier = new JeproshopCarrierModelCarrier($order->carrier_id, $order->lang_id);
$templateVars = array();
if ($orderHistory->order_status_id == JeproshopSettingModelSetting::getValue('order_status_shipping') && $order->shipping_number) {
}
if ($orderHistory->addWithEmail(true, $templateVars)) {
// synchronizes quantities if needed...
if (JeproshopSettingModelSetting::getValue('advanced_stock_management')) {
foreach ($order->getProducts() as $product) {
if (JeproshopStockAvailableModelStockAvailable::dependsOnStock($product->product_id)) {
JeproshopStockAvailableModelStockAvailable::synchronize($product->product_id, (int) $product->sho_id);
}
}
}
$app->redirect('index.php?option=com_jeproshop&view=order&task=view&order_id=' . (int) $order->order_id . '&' . JeproshopTools::getOrderToken() . '=1');
}
echo JText::_('COM_JEPROSHOP_AN_ERROR_OCCURRED_WHILE_CHANGING_ORDER_STATUS_OR_WE_WERE_UNABLE_TO_SEND_AN_EMAIL_TO_THE_CUSTOMER_MESSAGE');
} else {
echo JText::_('COM_JEPROSHOP_THE_ORDER_HAS_ALREADY_BEEN_ASSIGNED_THIS_STATUS_MESSAGE');
}
}
} else {
echo JText::_('COM_JEPROSHOP_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_THIS_ORDER_MESSAGE');
}
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:51,代码来源:order.php
示例18: defined
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
if (!file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'load.php')) {
JError::raiseError(500, JText::_(''));
}
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'load.php';
$context = JeproshopContext::getContext();
/** initialize the shop **/
$context->shop = JeproshopShopModelShop::initialize();
/** load configuration */
JeproshopSettingModelSetting::loadSettings();
/** load languages */
JeproshopLanguageModelLanguage::loadLanguages();
/** set context cookie */
$life_time = time() + max(JeproshopSettingModelSetting::getValue('bo_life_time'), 1) * 3600;
$context->cookie = new JeproshopCookie('jeproshop_site', '', $life_time);
/** @var employee */
$context->employee = new JeproshopEmployeeModelEmployee(JFactory::getUser()->id);
$context->cookie->employee_id = $context->employee->employee_id;
/** Loading default country */
$context->country = new JeproshopCountryModelCountry(JeproshopSettingModelSetting::getValue('default_country'), JeproshopSettingModelSetting::getValue('default_lang'));
/** if the cookie stored language is not an available language, use default language */
开发者ID:jeprodev,项目名称:jeproshop,代码行数:31,代码来源:jeproshop.php
示例19: isAssociatedToShop
public function isAssociatedToShop($shop_id = null)
{
if ($shop_id === null) {
$shop_id = JeproshopContext::getContext()->shop->shop_id;
}
$cache_id = 'jeproshop_model_shop_group_' . (int) $this->group_id . '_' . (int) $shop_id;
if (!JeproshopCache::isStored($cache_id)) {
$db = JFactory::getDBO();
$query = "SELECT shop_id FROM " . $db->quoteName('#__jeproshop_group_shop') . " WHERE ";
$query .= $db->quoteName('group_id') . " = " . $this->group_id . " AND shop_id = " . (int) $shop_id;
$db->setQuery($query);
JeproshopCache::store($cache_id, (bool) $db->loadResult());
}
return JeproshopCache::retrieve($cache_id);
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:15,代码来源:group.php
示例20: getManufacturerAddressesList
public function getManufacturerAddressesList($explicitSelect = TRUE)
{
jimport('joomla.html.pagination');
$db = JFactory::getDBO();
$app = JFactory::getApplication();
$option = $app->input->get('option');
$view = $app->input->get('view');
$context = JeproshopContext::getContext();
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int');
$limitstart = $app->getUserStateFromRequest($option . $view . '.limit_start', 'limit_start', 0, 'int');
$lang_id = $app->getUserStateFromRequest($option . $view . '.lang_id', 'lang_id', $context->language->lang_id, 'int');
$shop_id = $app->getUserStateFromRequest($option . $view . '.shop_id', 'shop_id', $context->shop->shop_id, 'int');
$shop_group_id = $app->getUserStateFromRequest($option . $view . '.shop_group_id', 'shop_group_id', $context->shop->shop_group_id, 'int');
$category_id = $app->getUserStateFromRequest($option . $view . '.category_id', 'category_id', 0, 'int');
$order_by = $app->getUserStateFromRequest($option . $view . '.order_by', 'order_by', 'position', 'string');
$order_way = $app->getUserStateFromRequest($option . $view . '.order_way', 'order_way', 'ASC', 'string');
$published = $app->getUserStateFromRequest($option . $view . '.published', 'published', 0, 'string');
/* Manage default params values */
$use_limit = true;
if ($limit === false) {
$use_limit = false;
}
$select = " country_lang." . $db->quoteName('name') . " AS country, manufacturer." . $db->quoteName('name') . " AS manufacturer_name ";
$join = " LEFT JOIN " . $db->quoteName('#__jeproshop_country_lang') . " AS country_lang ON (country_lang.";
$join .= $db->quoteName('country_id') . " = address." . $db->quoteName('country_id') . " AND country_lang.";
$join .= $db->quoteName('lang_id') . " = " . (int) $this->context->language->lang_id . ") LEFT JOIN ";
$join .= $db->quoteName('#__jeproshop_manufacturer') . " AS manufacturer ON (manufacturer." . $db->quoteName('manufacturer_id');
$join .= " = manufacturer." . $db->quoteName('manufacturer_id') . ") ";
$where = " AND address." . $db->quoteName('customer_id') . " = 0 AND address." . $db->quoteName('manufacturer_id') . " = 0 AND address.";
$where .= $db->quoteName('warehouse_id') . " = 0 AND address." . $db->quoteName('deleted') . " = 0";
do {
$query = "SELECT SQL_CALC_FOUND_ROWS " . ($tmpTableFilter ? " * FROM (SELECT " : "");
if ($explicitSelect) {
foreach ($fields_list as $key => $value) {
if (isset($select) && preg_match('/[\\s]`?' . preg_quote($key, '/') . '`?\\S*,/', $select)) {
continue;
}
if (isset($value['filter_key'])) {
$query .= str_replace('!', '.', $value['filter_key']) . " AS " . $key . ", ";
} elseif ($key == 'product_id') {
$query .= "product." . $db->quoteName($db->escape($key)) . ", ";
} elseif ($key != 'image' && !preg_match('/' . preg_quote($key, '/') . '/i', $select)) {
$query .= $db->quoteName($db->escape($key)) . ", ";
}
}
$query = rtrim($query, ',');
} else {
$query .= ($lang_id ? "product_lang.*, " : "") . "product.*";
}
$query .= (isset($select) ? rtrim($select, ", ") : "") . $select_shop . " FROM " . $db->quoteName('#__jeproshop_product');
$query .= " AS product " . $lang_join . (isset($join) ? $join . " " : "") . $join_shop . " WHERE 1 " . (isset($where) ? $where . " " : "");
$query .= ($this->deleted_product ? " AND product." . $db->quoteName('deleted') . " = 0 " : "") . (isset($filter) ? $filter : "") . $where_shop . (isset($group) ? $group . " " : "");
$query .= $having_clause . " ORDER BY " . (str_replace('`', '', $order_by) == 'product_id' ? "product_id" : "") . " product." . $db->quoteName($order_by) . " ";
$query .= $db->escape($order_way) . ($tmpTableFilter ? ") tmpTable WHERE 1" . $tmpTableFilter : "");
$query .= $use_limit === true ? " LIMIT " . (int) $limitstart . ", " . (int) $limit : "";
$db->setQuery($query);
$products = $db->loadObjectList();
if ($use_limit == true) {
$limitstart = (int) $limitstart - (int) $limit;
if ($limitstart < 0) {
break;
}
} else {
break;
}
} while (empty($products));
}
开发者ID:jeprodev,项目名称:jeproshop,代码行数:67,代码来源:manufacturer.php
注:本文中的JeproshopContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论