public function genreYML() { header('content-type: text/xml'); $ci = ShopCore::$ci; $pictureBaseUrl = base_url() . "uploads/shop/products/main/"; /* @var $p SProducts */ foreach ($this->getProducts() as $p) { /* @var $v SProductVariants */ foreach ($p->getProductVariants() as $v) { if (!$v->getPrice()) { continue; } $unique_id = $p->getId() . $v->getId(); $param = ShopCore::app()->SPropertiesRenderer->renderPropertiesArray($p); $this->offers[$unique_id]['url'] = ShopCore::$ci->config->item('base_url') . '/shop/product/' . $p->url; $this->offers[$unique_id]['price'] = $v->getPrice(); $this->offers[$unique_id]['currencyId'] = $this->currencyCode; $this->offers[$unique_id]['categoryId'] = $p->getCategoryId(); $this->offers[$unique_id]['picture'] = $pictureBaseUrl . $v->getMainImage(); $images = null; $images = $p->getSProductImagess(); if (count($images) > 0) { foreach ($images as $key => $image) { $this->offers[$unique_id]['picture' . $key] = productImageUrl('products/additional/' . $image->getImageName()); } } $this->offers[$unique_id]['name'] = $this->forName($p->getName(), $v->getName()); $this->offers[$unique_id]['vendor'] = $p->getBrand() ? htmlspecialchars($p->getBrand()->getName()) : ' '; $this->offers[$unique_id]['vendorCode'] = $v->getNumber() ? htmlspecialchars($v->getNumber()) : ' '; $this->offers[$unique_id]['description'] = htmlspecialchars($p->getFullDescription()); $this->db->select('value'); $this->db->where('id', 1); $query = $this->db->get('mod_yandex_market_adalt'); $adalt = $query->row_array(); if ($adalt['value'] == 1) { $this->offers[$unique_id]['adult'] = 'true'; } $this->offers[$unique_id]['param'] = $param; } } echo '<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE yml_catalog SYSTEM "shops.dtd"> <yml_catalog date="' . date('Y-m-d H:i') . '"> <shop> <name>' . $this->settings['site_short_title'] . '</name> <company>' . $this->settings['site_title'] . '</company> <url>' . $ci->config->item('base_url') . '</url> <platform>ImageCMS</platform> <version>' . IMAGECMS_NUMBER . '</version> <email>' . siteinfo('siteinfo_adminemail') . '</email>'; echo "\n\n"; echo '<currencies> <currency id="' . $this->currencyCode . '" rate="1"/> </currencies>' . "\n\n"; echo $this->renderCategories(); echo $this->renderOffers(); echo "</shop>\n"; echo "</yml_catalog>"; }
protected function loadSettings() { $settingsKey = $this->paymentMethod->getId() . '_TreasurerData'; $data = unserialize(ShopCore::app()->SSettings->{$settingsKey}); if ($data === false) { $data = array(); } return array_map('encode', $data); }
public function set_price($priceRange = null) { if (null === $priceRange) { $priceRange = \ShopCore::app()->SFilter->getPricerange(); } $minPrice = (int) $priceRange['minCost']; $maxPrice = (int) $priceRange['maxCost']; $curMin = $_GET['lp'] ? (int) $_GET['lp'] : $minPrice; $curMax = $_GET['rp'] ? (int) $_GET['rp'] : $maxPrice; \CMSFactory\assetManager::create()->setData(array('minPrice' => (int) $priceRange['minCost'], 'maxPrice' => (int) $priceRange['maxCost'], 'curMax' => $curMax, 'curMin' => $curMin)); }
public function genreYML($indicator = null) { header('content-type: text/xml'); $ci = ShopCore::$ci; $pictureBaseUrl = base_url() . "uploads/shop/products/main/"; /* @var $p SProducts */ foreach ($this->getProducts() as $p) { /* @var $v SProductVariants */ foreach ($p->getProductVariants() as $v) { if (!$v->getPrice()) { continue; } $unique_id = $p->getId() . $v->getId(); $param = ShopCore::app()->SPropertiesRenderer->renderPropertiesArray($p); $this->offers[$unique_id]['url'] = ShopCore::$ci->config->item('base_url') . '/shop/product/' . $p->url; $this->offers[$unique_id]['priceRUAH'] = $v->getPrice(); $this->offers[$unique_id]['categoryId'] = $p->getCategoryId(); $this->offers[$unique_id]['image'] = $pictureBaseUrl . $v->getMainImage(); if ($indicator == null) { $this->offers[$unique_id]['name'] = $this->forName($p->getName(), $v->getName()); } if ($indicator == 1) { $vendor = $p->getBrand() ? htmlspecialchars($p->getBrand()->getName()) : ' '; $name = $this->forName($p->getName(), $v->getName()); $query = $this->db->query("\n SELECT shop_product_properties_data.value FROM mod_hotline_properties\n LEFT JOIN shop_product_properties_data ON (mod_hotline_properties.property_id = shop_product_properties_data.property_id)\n WHERE shop_product_properties_data.product_id = " . $p->getId() . " and category_id = " . $p->getCategoryId() . " \n "); $arr = $query->result_array(); $properties = ''; foreach ($arr as $value) { $properties .= $value['value'] . ' '; } $this->offers[$unique_id]['name'] = $vendor . ' ' . $p->getName() . ' ' . $v->getNumber() . ' ' . $properties; } $this->offers[$unique_id]['vendor'] = $p->getBrand() ? htmlspecialchars($p->getBrand()->getName()) : ' '; $this->offers[$unique_id]['code'] = $v->getNumber() ? htmlspecialchars($v->getNumber()) : ' '; $this->offers[$unique_id]['description'] = htmlspecialchars($p->getFullDescription()); if ((int) $v->getStock() > 0) { $this->offers[$unique_id]['stock'] = 'На складе'; } } } $model = ShopSettingsQuery::create()->filterByName('shopNumber')->findOne(); $shop = $model->getValue(); echo '<?xml version="1.0" encoding="utf-8"?> <price> <date>' . date('Y-m-d H:i') . '</date> <firmName>' . $this->settings['site_title'] . '</firmName> <firmId>' . $shop . '</firmId> <rate>8.12</rate>'; echo "\n\n"; echo $this->renderCategoriesHotline(); echo $this->renderOffersHotline(); echo "</price>\n"; }
/** * Provides user login * @return json * @access public * @copyright ImageCMS (c) 2013 */ public function login() { if (!$this->dx_auth->is_logged_in()) { $this->form_validation->set_message('required', lang('The %s is required', 'auth')); /** Set form validation rules */ $this->form_validation->set_rules('email', lang('E-Mail Address', 'auth'), 'trim|required|min_length[3]|xss_clean|valid_email|callback_email_check_for_login'); $this->form_validation->set_rules('password', lang('Password', 'auth'), 'trim|required|min_length[3]|max_length[30]|xss_clean'); $this->form_validation->set_rules('remember', lang('Remeber me', 'auth'), 'integer'); $this->form_validation->set_rules('redirect_to', lang('Redirect to', 'auth'), 'trim|min_length[3]|max_length[255]|xss_clean'); /** Validate rules and change password */ $validationResult = $this->form_validation->run(); $doLoginResult = $this->dx_auth->login($this->input->post('email'), $this->input->post('password'), $this->input->post('remember')); /** Prepare response */ if (true === $validationResult and true === $doLoginResult) { if (class_exists('ShopCore') && SHOP_INSTALLED) { ShopCore::app()->SCart->transferCartData(); } $jsonResponse['msg'] = lang('User successfully logged in', 'auth'); $jsonResponse['status'] = true; $jsonResponse['refresh'] = true; $jsonResponse['redirect'] = FAlSE; } else { /** Check if the user is failed logged in because user is banned user or not */ if ($this->dx_auth->is_banned()) { $this->ban_reason = $this->dx_auth->get_ban_reason(); $this->banned(); exit; } else { $validationResult = validation_errors(); if (empty($validationResult)) { $jsonResponse['msg'] = lang('User with this name and password is not found', 'auth'); $jsonResponse['validations'] = array('email' => lang('User with this name and password is not found', 'auth')); } else { $jsonResponse['msg'] = $validationResult; $jsonResponse['validations'] = array('email' => form_error('email'), 'password' => form_error('password'), 'remember' => form_error('remember')); } /** Return json data for render login form */ $jsonResponse['status'] = false; $jsonResponse['refresh'] = false; $jsonResponse['redirect'] = false; } } } else { $jsonResponse['refresh'] = false; $jsonResponse['redirect'] = false; $jsonResponse['status'] = false; $jsonResponse['msg'] = lang('User is already logged in', 'auth'); } /** return JSON Data */ echo json_encode($jsonResponse); }
/** * Generates an array of data to create a body xml */ public function index() { $ci = ShopCore::$ci; $this->settings = $this->ymarket_model->init(); $this->currencyCode = ShopCore::app()->SCurrencyHelper->current->code; $categories = \Category\CategoryApi::getInstance()->getCategory($this->settings['unserCats']); /* @var $p SProducts */ foreach ($this->ymarket_model->getProducts($this->settings['unserCats']) as $p) { $param = ShopCore::app()->SPropertiesRenderer->renderPropertiesArray($p); $additionalImages = $this->getAdditionalImages($p); /* @var $v SProductVariants */ foreach ($p->getProductVariants() as $v) { if (!$v->getPrice()) { continue; } $unique_id += $p->getId() . '.' . $v->getId(); $this->offers[$unique_id]['url'] = $ci->config->item('base_url') . '/shop/product/' . $p->url; $this->offers[$unique_id]['price'] = $v->getPrice(); $this->offers[$unique_id]['currencyId'] = $this->currencyCode; $this->offers[$unique_id]['categoryId'] = $p->getCategoryId(); $this->offers[$unique_id]['picture'] = array_merge(array(productImageUrl('products/main/' . $v->getMainImage())), $additionalImages); $this->offers[$unique_id]['name'] = $this->forName($p->getName(), $v->getName()); $this->offers[$unique_id]['vendor'] = $p->getBrand() ? htmlspecialchars($p->getBrand()->getName()) : ''; $this->offers[$unique_id]['vendorCode'] = $v->getNumber() ? $v->getNumber() : ''; $this->offers[$unique_id]['description'] = htmlspecialchars($p->getFullDescription()); if ($this->settings['adult']) { $this->offers[$unique_id]['adult'] = 'true'; } $this->offers[$unique_id]['param'] = $param; } } $infoXml['categories'] = $categories; $infoXml['offers'] = $this->offers; $infoXml['site_short_title'] = $this->settings['site_short_title']; $infoXml['site_title'] = $this->settings['site_title']; $infoXml['base_url'] = $ci->config->item('base_url'); $infoXml['imagecms_number'] = IMAGECMS_NUMBER; $infoXml['siteinfo_adminemail'] = siteinfo('siteinfo_adminemail'); $infoXml['currencyCode'] = $this->currencyCode; \CMSFactory\assetManager::create()->setData('infoXml', $infoXml)->render('main', true); exit; }
public function _install() { $this->db->where('name', 'digital_products')->update('components', array('autoload' => '1', 'enabled' => '1')); $field = new CustomFields(); $field->setEntity('Product')->setIsActive(true)->setname('dplink')->setfLabel('Link to digital content')->settypeId(3); $field->save(); ShopCore::app()->SSettings->set('DPLinkCFID', $field->getId()); /** We recomend to use http://ellislab.com/codeigniter/user-guide/database/forge.html */ /** $this->load->dbforge(); $fields = array( 'id' => array('type' => 'INT', 'constraint' => 11, 'auto_increment' => TRUE,), 'name' => array('type' => 'VARCHAR', 'constraint' => 50,), 'value' => array('type' => 'VARCHAR', 'constraint' => 100,) ); $this->dbforge->add_key('id', TRUE); $this->dbforge->add_field($fields); $this->dbforge->create_table('mod_empty', TRUE); */ /** */ }
<?php if ($pagination > '') { ?> <?php if (isset($pagination)) { echo $pagination; } ?> <?php } ?> <div class="pagination pull-right"> <select style="max-width:60px;" onchange="change_per_page(this); return false;"> <?php if ($_COOKIE['per_page'] == ShopCore::app()->SSettings->adminProductsPerPage) { ?> <option selected="selected" value="<?php echo $_COOKIE['per_page']; ?> "><?php echo $_COOKIE['per_page']; ?> </option><?php } ?> <option <?php if ($_COOKIE['per_page'] == 10) { ?> selected="selected"<?php }
</section> </div> <?php } ?> <!-- End. Kits--> <!-- Start. Tabs block--> <ul class="tabs tabs-data tabs-product"> <li class="active"> <button data-href="#view"><?php echo lang('Обзор', 'lightVertical'); ?> </button> </li> <?php if ($dl_properties = ShopCore::app()->SPropertiesRenderer->renderPropertiesTableNew($model->getId())) { ?> <li><button data-href="#first" data-source="<?php echo shop_url('product_api/renderProperties'); ?> " data-data='{"product_id": <?php echo $model->getId(); ?> }' data-selector=".characteristic"><?php echo lang('Свойства', 'lightVertical'); ?> </button></li> <?php } ?>
?> </div> <!-- End. Wish List & Compare List buttons --> </div> <?php } ?> <!-- End. Collect information about Variants, for future processing --> <?php if (!$opi_widget && !$opi_compare && !$opi_defaultItem && !$opi_wishListPage) { ?> <div class="frame-without-top"> <div class="no-vis-table"> <!--Start. Description--> <?php if ($props = ShopCore::app()->SPropertiesRenderer->renderPropertiesInlineNew($p->getId())) { ?> <div class="short-desc"> <p><?php echo $props; ?> </p> </div> <?php } elseif (trim($p->getShortDescription()) != '') { ?> <div class="short-desc"> <?php echo strip_tags($p->getShortDescription()); ?> </div>
function login() { // ($hook = get_hook('auth_on_login')) ? eval($hook) : NULL; $this->core->set_meta_tags(lang('Authorization', 'auth')); if (!$this->dx_auth->is_logged_in()) { $val = $this->form_validation; // Set form validation rules $val->set_rules('email', lang("Email"), 'trim|required|min_length[3]|xss_clean|valid_email'); $val->set_rules('password', lang("Password"), 'trim|required|min_length[3]|max_length[30]|xss_clean'); $val->set_rules('remember', 'Remember me', 'integer'); // Set captcha rules if login attempts exceed max attempts in config if ($this->dx_auth->is_max_login_attempts_exceeded()) { if ($this->dx_auth->use_recaptcha) { $val->set_rules('recaptcha_response_field', lang('Code protection', 'auth'), 'trim|xss_clean|required|callback_captcha_check'); } else { $val->set_rules('captcha', lang('Code protection', 'auth'), 'trim|required|xss_clean|callback_captcha_check'); } } if ($val->run() and $this->dx_auth->login($val->set_value('email'), $val->set_value('password'), $val->set_value('remember'))) { // ($hook = get_hook('auth_login_success')) ? eval($hook) : NULL; // Redirect to homepage if (class_exists('ShopCore') && SHOP_INSTALLED) { ShopCore::app()->SCart->transferCartData(); } if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') { redirect('', 'location'); } else { $this->template->add_array(array('is_logged_in' => $this->dx_auth->is_logged_in())); $template = $this->template->fetch('shop/default/auth_data'); return json_encode(array('close' => true, 'msg' => "<div class='fancy authcomplete'><h1>" . lang('Authorization', 'auth') . "</h1><div class='comparison_slider'><div class='f-s_18 m-t_29 t-a_c'>" . lang('Authorization successfully completed', 'auth') . "</div></div></div>", 'header' => $template, 'reload' => 1)); } } else { // ($hook = get_hook('auth_login_failed')) ? eval($hook) : NULL; $this->template->assign('info_message', $this->dx_auth->get_auth_error()); // Check if the user is failed logged in because user is banned user or not if ($this->dx_auth->is_banned()) { ($hook = get_hook('auth_user_banned')) ? eval($hook) : NULL; // Redirect to banned uri //$this->dx_auth->deny_access('banned'); $this->ban_reason = $this->dx_auth->get_ban_reason(); $this->banned(); exit; } else { // Default is we don't show captcha until max login attempts eceeded $data['show_captcha'] = FALSE; // Show captcha if login attempts exceed max attempts in config if ($this->dx_auth->is_max_login_attempts_exceeded()) { // ($hook = get_hook('auth_login_attemps_exceeded')) ? eval($hook) : NULL; // Create catpcha $this->dx_auth->captcha(); $this->template->assign('cap_image', $this->dx_auth->get_captcha_image()); // Set view data to show captcha on view file $data['show_captcha'] = TRUE; } // ($hook = get_hook('auth_show_login_tpl')) ? eval($hook) : NULL; // Load login page view if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') { $this->template->show('login'); } else { $this->template->display('login_popup'); } } } } else { // ($hook = get_hook('auth_user_is_logged')) ? eval($hook) : NULL; redirect(site_url(), 301); $this->template->assign('content', lang('You are already logged.', 'auth')); $this->template->show(); } }
/** * Selecting categories to generate xml * @return obj category, check adult and ids selectet category */ public function getSelectedCats() { $data->categories = ShopCore::app()->SCategoryTree->getTree(); $data->ymarket_model = $this->ymarket_model->init(); return $data; }
/** * Edit discount * @paran (int) $id * @paran (string) $locale * @return html */ public function edit($id, $locale = null) { if (null === $locale) { $locale = \MY_Controller::getCurrentLocale(); } if ($this->input->post()) { $postArray = $this->input->post(); $typeDiscount = $postArray['type_discount']; $discauntManager = new \mod_discount\classes\DiscountManager(); $discauntManager->validation($postArray, $id); if (count($discauntManager->error) == 0) { // If empty field with discount key, then generate key if ($postArray['key'] == null) { $postArray['key'] = $this->generateDiscountKey(); } //Prepare data for insert in table mod_shop_discounts $data = array('name' => $postArray['name'], 'key' => $postArray['key'], 'max_apply' => $postArray['max_apply'], 'type_value' => $postArray['type_value'], 'value' => $postArray['value'], 'type_discount' => $typeDiscount, 'date_begin' => strtotime($postArray['date_begin']), 'date_end' => strtotime($postArray['date_end']), 'active' => '1'); //Prepare data for inserting in the table of selected discount type $typeDiscountData = $postArray[$typeDiscount]; // Check range for cumulative discount if ($typeDiscount == "comulativ" and $this->discount_model_admin->checkRangeForCumulativeDiscount($postArray[$typeDiscount], $id)) { showMessage(lang('Has been already created with the cumulative discount value', 'mod_discount'), '', 'r'); return; } // Insert data if ($this->discount_model_admin->updateDiscountById($id, $data, $typeDiscountData, $locale)) { showMessage(lang('Changes saved', 'mod_discount')); } //Return to list of discounts, if user clicked 'save and exit' if ($postArray['action'] == 'tomain') { pjax('/admin/components/init_window/mod_discount/index' . $_SESSION['QueryDiscountList']); } else { pjax('/admin/components/init_window/mod_discount/edit/' . $id); } } else { showMessage(implode('<br/> ', $discauntManager->error), '', 'r'); } } else { //Get list of user roles and info about current discount $userGroups = $this->discount_model_admin->getUserGroups(MY_Controller::getCurrentLocale()); $discountData = $this->discount_model_admin->getDiscountAllDataById($id, $locale); //if can't get info about discount from database then 404 error if ($discountData == false) { $this->error404(lang('Discount not found', 'mod_discount')); } //If discount type user then get user name and email if ($discountData['type_discount'] == 'user') { $discountData['user']['userInfo'] = $this->discount_model_admin->getUserNameAndEmailById($discountData['user']['user_id']); } //If discount type product then get product name if ($discountData['type_discount'] == 'product') { $discountData['product']['productInfo'] = $this->discount_model_admin->getProductById($discountData['product']['product_id']); } //Prepare date for rendering $data = array('discount' => $discountData, 'userGroups' => $userGroups, 'CS' => $this->discount_model_admin->getMainCurrencySymbol(), 'filterQuery' => $_SESSION['QueryDiscountList'], 'categories' => ShopCore::app()->SCategoryTree->getTree(), 'languages' => $this->db->get('languages')->result_array(), 'locale' => $locale); //Render template and set data \CMSFactory\assetManager::create()->setData($data)->renderAdmin('edit'); } }
/** * Prepare and return template for module * @param type $data * @param type $pageId * @return type */ public function prepareInterface($data, $pageId) { $currentCategories = $this->db->where('content_id', $pageId)->get('mod_shop_news')->row_array(); $currentCategories = explode(',', $currentCategories['shop_categories_ids']); return \CMSFactory\assetManager::create()->setData(array('shopNews' => $data, 'categories' => ShopCore::app()->SCategoryTree->getTree(), 'currentCategories' => $currentCategories))->registerScript('scripts')->fetchTemplate('/admin/adminModuleInterface'); }
/** * get categories * @return array */ public function getCategories() { $locale = MY_Controller::getCurrentLocale(); $categories = ShopCore::app()->SCategoryTree->getTree(); return $categories; }
public function sidebar_cats() { echo '<div id="categories">'; if (isset($_GET['first'])) { $this->db->where('name', 'shop'); $this->db->limit(1); $query = $this->db->get('components'); if ($query->num_rows() > 0) { ShopCore::app()->SAdminSidebarRenderer->render(); exit; } } $this->template->assign('tree', $this->lib_category->build()); $this->template->show('cats_sidebar', FALSE); echo '</div>'; }
/** * apply user gift * @access private * @author DevImageCms * @param --- * @return --- * @copyright (c) 2013, ImageCMS */ private function applyGift() { $key = $this->input->post('gift'); $aplyGift = false; foreach ($this->baseDiscount->discountType['all_order'] as $disc) { if ($disc['key'] == $key and $disc['is_gift']) { $value = $this->baseDiscount->getDiscountValue($disc, $this->baseDiscount->cart->getTotalPrice()); $this->baseDiscount->cart->gift_info = $disc['key']; $this->baseDiscount->cart->gift_value = $value; if (\ShopCore::app()->SSettings->pricePrecision == 0) { $this->baseDiscount->cart->gift_value = floor($value); } $cartTotalPrice = $this->baseDiscount->cart->getTotalPrice() - $value; $this->baseDiscount->cart->setTotalPrice($cartTotalPrice > 0 ? $cartTotalPrice : \Cart\BaseCart::MIN_ORDER_PRICE); $aplyGift = true; break; } } if (!$aplyGift) { $this->baseDiscount->cart->gift_error = TRUE; } }
/** * get discount in json format * @access public * @author DevImageCms * @param (bool) typeReturn optional * @param array $option params: * - (float) price: * - (int) userId: * - (bool) ignoreCart: ignore cart Data: * - (bool) new: for redeclare singelton: * @return json * @copyright (c) 2013, ImageCMS */ public function getDiscount($option = array(), $typeReturn = null) { if (count($option) > 0) { \mod_discount\classes\BaseDiscount::prepareOption($option); } $this->baseDiscount = \mod_discount\classes\BaseDiscount::create(); if (\mod_discount\classes\BaseDiscount::checkModuleInstall()) { $discount['max_discount'] = $this->baseDiscount->discountMax; $discount['sum_discount_product'] = $this->baseDiscount->discountProductVal; $discount['sum_discount_no_product'] = $this->baseDiscount->discountNoProductVal; if ($this->baseDiscount->discountProductVal > $this->baseDiscount->discountNoProductVal) { $discount['result_sum_discount'] = $this->baseDiscount->discountProductVal; $discount['type'] = 'product'; } else { $discount['result_sum_discount'] = $this->baseDiscount->discountNoProductVal; $discount['type'] = 'user'; } $discount['result_sum_discount_convert'] = ShopCore::app()->SCurrencyHelper->convert($discount['result_sum_discount']); } if ($discount['result_sum_discount']) { if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' && !$typeReturn) { echo json_encode($discount); } else { return $discount; } } else { echo ''; } }
</ul> </nav> </div> </div> <?php } ?> <form method="get" id="catalogForm"> <input type="hidden" name="order" value="<?php echo $order_method; ?> " /> <input type="hidden" name="user_per_page" value="<?php if (!$_GET['user_per_page']) { echo \ShopCore::app()->SSettings->frontProductsPerPage; } else { echo $_GET['user_per_page']; } ?> "/> <div class="frame-filter p_r"> <?php $this->include_tpl('filter', '/home/igor/sites/skidka-shop.com.ua/www/templates/lightVertical/smart_filter'); ?> </div> </form> <?php $mabilis_ttl = 1444767655; $mabilis_last_modified = 1440056636; ///home/igor/sites/skidka-shop.com.ua/www/templates/lightVertical/smart_filter/main.tpl
', cartItemsProductsId = <?php echo json_encode($arrCartId); ?> , nextCs = '<?php echo $NextCS; ?> ', nextCsCond = nextCs == '' ? false : true, pricePrecision = parseInt('<?php echo ShopCore::app()->SSettings->pricePrecision; ?> '), checkProdStock = "<?php echo ShopCore::app()->SSettings->ordersCheckStocks; ?> ", //use in plugin plus minus inServerCompare = parseInt("<?php if (isset($cnt_comp)) { echo $cnt_comp; } ?> "), inServerWishList = parseInt("<?php if (isset($countWL)) { echo $countWL; } ?> "), countViewProd = parseInt("<?php
/** * Render admin template */ public function renderAdmin() { $categories = \ShopCore::app()->SCategoryTree->getTree(); $categoriesT = array(); foreach ($categories as $category) { if ($category->parent_id == 0) { $categoriesT[$category->id]['category'] = $category; } } foreach ($categories as $category) { if ($categoriesT[$category->parent_id]) { if (!$categoriesT[$category->parent_id]['children']) { $categoriesT[$category->parent_id]['children'] = array(); } $categoriesT[$category->parent_id]['children'][$category->id]['category'] = $category; } } foreach ($categories as $category) { foreach ($categoriesT as $key => $categoryT) { if (isset($categoryT['children']) && $categoryT['children'][$category->parent_id]) { if (!$categoriesT[$key]['children'][$category->parent_id]['children']) { $categoriesT[$key]['children'][$category->parent_id]['children'] = array(); } $categoriesT[$key]['children'][$category->parent_id]['children'][] = $category; } } } $this->cAssetManager->registerScript('scripts', 'after'); $this->cAssetManager->display('admin/main', array('handler' => $this->name, 'openLevels' => $this->getOpenLevels(), 'categoriesT' => $categoriesT)); }
function sending_forgot_password_email($data, &$content) { if (class_exists(ShopCore)) { $replaceData = array('%webSiteName%' => $this->ci->config->item('DX_website_name'), '%resetPasswordUri%' => $data['reset_password_uri'], '%password%' => $data['password'], '%key%' => $data['key'], '%webMasterEmail%' => $this->ci->config->item('DX_webmaster_email')); $content = str_replace(array_keys($replaceData), $replaceData, ShopCore::app()->SSettings->forgotPasswordMessageText); } else { // Create content $content = sprintf($this->ci->lang->line('auth_forgot_password_content'), $this->ci->config->item('DX_website_name'), $data['reset_password_uri'], $data['password'], $data['key'], $this->ci->config->item('DX_webmaster_email'), $this->ci->config->item('DX_website_name')); } }
/** * get discount for product in cart with his discount * @access private * @author DevImageCms * @param ---- * @return float * @copyright (c) 2013, ImageCMS */ private function getDiscountProducts() { foreach ($this->cartData as $item) { $priceOrigin = number_format($item->originPrice, \ShopCore::app()->SSettings->pricePrecision, '.', ''); // new Cart if (abs($priceOrigin - $item->price) > 1) { $discountValue += ($priceOrigin - $item->price) * $item->quantity; } } return $discountValue; }
* $product->name(): method which return product name * $product->getmainimage(): method which return product main image * $product->getId(): method which return product id * * $pagination: variale which contains HTML code of page pagination * * $totalProducts: variale which contains total count of products in brand category * * $model: (object) instance of SBrands * * $Comments: array which contains count of comments for each product */ ?> <!-- Get category tree --> <?php ShopCore::app()->SCategoryTree->getTree(SCategoryTree::MODE_MULTI); ?> <div class="frame-crumbs"> <?php echo widget('path'); ?> </div> <div class="frame-menu-main vertical-menu"> <?php \Category\RenderMenu::create()->setConfig(array('cache' => TRUE))->load('category_menu'); ?> </div> <div class="content"> <div class="frame-inside">
?> setAction" data-rel="tooltip" data-placement="top" data-original-title="<?php echo lang('Promotion', 'admin'); ?> "><i class="icon-star"></i> </button> <?php } ?> </td> <td> <span class="pull-right"> <span class="neigh_form_field help-inline"></span> <?php echo ShopCore::app()->SCurrencyHelper->getSymbolById($model->firstVariant->getCurrency()); ?> </span> <div class="p_r o_h frame_price number"> <?php $price = preg_replace('/\\.?0*$/', '', number_format($model->firstVariant->getPriceInMain(), 5, ".", "")); ?> <?php $price = $price ? $price : 0; ?> <input type="text" value="<?php if (isset($price)) { echo $price; }
function register($username, $password, $email, $address = '', $key, $phone = '', $login_user = TRUE) { // Load Models $this->ci->load->model('dx_auth/users', 'users'); $this->ci->load->model('dx_auth/user_temp', 'user_temp'); $this->ci->load->helper('url'); // Default return value $result = FALSE; $new_user = array('username' => $username, 'password' => crypt($this->_encode($password)), 'address' => $address, 'email' => $email, 'key' => $key, 'phone' => $phone, 'last_ip' => $this->ci->input->ip_address()); // Do we need to send email to activate user if ($this->ci->config->item('DX_email_activation')) { // Add activation key to user array $new_user['activation_key'] = md5(rand() . microtime()); // Create temporary user in database which means the user still unactivated. $insert = $this->ci->user_temp->create_temp($new_user); $from = $this->ci->config->item('DX_webmaster_email'); $subject = sprintf(lang('auth activate subject'), $this->ci->config->item('DX_website_name')); // Activation Link $new_user['activate_url'] = site_url($this->ci->config->item('DX_activate_uri') . "{$new_user['email']}/{$new_user['activation_key']}"); // Trigger event and get email content $this->ci->dx_auth_event->sending_activation_email($new_user, $message); // Send email with activation link // $this->_email($email, $from, $subject, $message); } else { // Create user $insert = $this->ci->users->create_user($new_user); $last_user_id = $this->ci->db->insert_id(); // Trigger event $this->ci->dx_auth_event->user_activated($last_user_id); } if ($insert) { // Replace password with plain for email $new_user['password'] = $password; $new_user['id_user'] = $last_user_id; $result = $new_user; // Send email based on config // Check if user need to activate it's account using email if ($this->ci->config->item('DX_email_activation')) { // Create email $from = $this->ci->config->item('DX_webmaster_email'); $subject = sprintf(lang('auth activate subject'), $this->ci->config->item('DX_website_name')); // Activation Link $new_user['activate_url'] = site_url(); // Trigger event and get email content $this->ci->dx_auth_event->sending_account_email($new_user, $message); // Send email with activation link // $this->_email($email, $from, $subject, $message); } else { // Check if need to email account details if ($this->ci->config->item('DX_email_account_details')) { // Create email $from = $this->ci->config->item('DX_webmaster_email'); $subject = sprintf(lang('auth account subject'), $this->ci->config->item('DX_website_name')); // Trigger event and get email content $this->ci->dx_auth_event->sending_account_email($new_user, $message); // Send email with account details // $this->_email($email, $from, $subject, $message); } $user_variables = array('user_name' => $username, 'user_password' => $password, 'user_address' => $address, 'user_email' => $email, 'user_phone' => $phone); \cmsemail\email::getInstance()->sendEmail($email, 'create_user', $user_variables); if ($login_user) { if ($this->login($email, $password)) { if (class_exists('ShopCore')) { ShopCore::app()->SCart->transferCartData(); } if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') { redirect('', 'location'); } // if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') { } } } } return $result; }
/** * get origin product price for id variant * @param (int) $id * @return (float) price */ public function getPrice($id) { $priceProd = $this->db->query("select price from shop_product_variants where id = '{$id}'")->row(); return number_format($priceProd->price, ShopCore::app()->SSettings->pricePrecision, '.', ''); }
public function get_vsettings() { $settings = ShopCore::app()->SSettings->__get('vk_int'); $settings = unserialize($settings); return $settings; }