public function executeUpdate($request) { $source = $request->getParameter('transUnit'); $unitvars = $request->getParameter('unitvars'); foreach ($unitvars as $lang => $val) { // 1. check that $lang catalogue exists $catalogue = Doctrine::getTable('Catalogue')->findOneByTargetLangAndName($lang, 'messages.' . $lang); if (!$catalogue) { //1.1 if not then add it $catalogue = new Catalogue(); $catalogue->fromArray(array('name' => 'messages.' . $lang, 'source_lang' => 'en', 'target_lang' => $lang)); $catalogue->save(); } $transUnit = Doctrine::getTable('TransUnit')->findOneByLangAndCategory($source, $catalogue->cat_id); if (!$transUnit) { $transUnit = new TransUnit(); $transUnit->fromArray(array('source' => $source)); $transUnit->setCatalogue($catalogue); } $transUnit->setTarget($val); $transUnit->translated = empty($val) ? 0 : 1; $transUnit->save(); } $this->clearCache(); $this->redirect('@admin_page?module=translation&action=edit&source=' . $source); }
public function getItems() { $this->_basket = Session::getSession('basket'); if (!empty($this->_basket)) { $objCatalogue = new Catalogue(); foreach ($this->_basket as $key => $value) { $this->_items[$key] = $objCatalogue->getProduct($key); } } }
public function getCatalogueID($lang) { $cat = Doctrine::getTable('Catalogue')->findOneByNameAndTargetLang($this->getCatalogueBaseName() . '.' . $lang, $lang); if ($cat) { return $cat['cat_id']; } else { $cat = new Catalogue(); $cat->fromArray(array('name' => $this->getCatalogueBaseName() . '.' . $lang, 'source_lang' => 'en', 'target_lang' => $lang)); $cat->save(); return $cat['cat_id']; } }
/** * Setup the instance (singleton) * * @return Catalogue */ public static function getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public function validate() { $result = parent::validate(); if (Catalogue::get()->filter(array('Video_title' => $this->Video_Title))->first()) { $result->error('This media has already been inserted to the catalogue.'); } return $result; }
/** * Constructor */ private function __construct() { // Register post type and settings add_action('init', [$this, 'registerPostType']); add_filter('init', [$this, 'registerTaxonomies']); add_filter('init', [$this, 'registerFields']); // Edit search template add_filter('search_template', [$this, 'registerSearchTemplate']); add_filter('wp_title', [$this, 'fixSearchTitle'], 5, 3); // Apply price discounts on save add_action('acf/save_post', [$this, 'saveDiscountedPrice'], 20); // Set default product meta query add_filter('cgit_product_meta_query', [$this, 'setMetaQuery'], 10, 2); // Register widgets add_action('widgets_init', [$this, 'registerWidgets']); // Initialize catalogue Catalogue::getInstance(); }
/** * Check catalogue URL's before we get to the CMS (if it exists) * * @param SS_HTTPRequest $request * @param DataModel|null $model * @return SS_HTTPResponse */ public function handleRequest(SS_HTTPRequest $request, DataModel $model) { $this->request = $request; $this->setDataModel($model); $catalogue_enabled = Catalogue::config()->enable_frontend; $this->pushCurrent(); // Create a response just in case init() decides to redirect $this->response = new SS_HTTPResponse(); $this->init(); // If we had a redirection or something, halt processing. if ($this->response->isFinished()) { $this->popCurrent(); return $this->response; } // If DB is not present, build if (!DB::isActive() || !ClassInfo::hasTable('CatalogueProduct') || !ClassInfo::hasTable('CatalogueCategory')) { return $this->response->redirect(Director::absoluteBaseURL() . 'dev/build?returnURL=' . (isset($_GET['url']) ? urlencode($_GET['url']) : null)); } $urlsegment = $request->param('URLSegment'); $this->extend('onBeforeInit'); $this->init(); $this->extend('onAfterInit'); // Find link, regardless of current locale settings if (class_exists('Translatable')) { Translatable::disable_locale_filter(); } $filter = array('URLSegment' => $urlsegment, 'Disabled' => 0); if ($catalogue_enabled && ($object = CatalogueProduct::get()->filter($filter)->first())) { $controller = $this->controller_for($object); } elseif ($catalogue_enabled && ($object = CatalogueCategory::get()->filter($filter)->first())) { $controller = $this->controller_for($object); } elseif (class_exists('ModelAsController')) { // If CMS installed $controller = ModelAsController::create(); } else { $controller = Controller::create(); } if (class_exists('Translatable')) { Translatable::enable_locale_filter(); } $result = $controller->handleRequest($request, $model); $this->popCurrent(); return $result; }
public function getItemSummary() { $modify_price = $this->ModifyPrice; $price = new Currency(); $tax_id = $this->Parent()->Parent()->TaxRateID; if ($tax_id && Catalogue::config()->price_includes_tax) { $modify_price += $modify_price / 100 * $this->Parent()->Parent()->TaxRate()->Amount; } $price->setValue($modify_price); if ($price->RAW() > 0) { $summary = $this->Title . ' +' . $price->nice(); } elseif ($price->RAW() < 0) { $summary = $this->Title . ' -' . str_replace(array("(", ")"), "", $price->nice()); } else { $summary = $this->Title; } $this->extend('updateItemSummary', $summary); return $summary; }
/** * gets genres as a separate query sorts and removes duplicates * * @return string */ public function getGenres() { $result = Catalogue::get()->sort('Genre')->where('Genre is not null')->column($colName = "Genre"); if ($result != null) { /** clean up keywords from DB **/ $_list = array(parent::__convertAndCleanList($result, '|')); $genreList = ""; foreach ($_list as $list) { foreach ($list as $value) { $genreList .= "<li><span data-path=\"." . str_replace(' ', '', $value) . "\">" . $value . "</span></li>"; } } return $genreList; } }
/** * Generate a string to go with the the product price. We can * overwrite the wording of this by using Silverstripes language * files * * @return String */ public function getTaxString() { if ($this->TaxRateID && Catalogue::config()->price_includes_tax) { $return = _t("Catalogue.TaxIncludes", "Includes") . " " . $this->TaxRate()->Title; } elseif ($this->TaxRateID && !Catalogue::config()->price_includes_tax) { $return = _t("Catalogue.TaxExcludes", "Excludes") . " " . $this->TaxRate()->Title; } else { $return = ""; } return $return; }
$GLOBALS['hooks'] = HookLoader::getInstance(); //Initialize SEO $GLOBALS['seo'] = SEO::getInstance(); if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) { $_GET['seo_path'] = preg_replace('/(\\/\\~[a-z0-9]{1,}\\/)/', '', $_GET['seo_path']); // Remove /~username/ from seo_path $GLOBALS['seo']->getItem($_GET['seo_path']); } //Initialize SSL $GLOBALS['ssl'] = SSL::getInstance(); //Initialize GUI $GLOBALS['gui'] = GUI::getInstance(); //Initialize Taxes $GLOBALS['tax'] = Tax::getInstance(); //Initialize catalogue $GLOBALS['catalogue'] = Catalogue::getInstance(); //Initialize cubecart $GLOBALS['cubecart'] = Cubecart::getInstance(); //Initialize user $GLOBALS['user'] = User::getInstance(); //Initialize cart $GLOBALS['cart'] = Cart::getInstance(); // Set store timezone - default to UTC date_default_timezone_set($GLOBALS['config']->get('config', 'time_zone') ? $GLOBALS['config']->get('config', 'time_zone') : 'UTC'); if ($GLOBALS['config']->get('config', 'recaptcha') && !$GLOBALS['session']->get('confirmed', 'recaptcha')) { $recaptcha['error'] = null; $recaptcha['confirmed'] = false; if ($GLOBALS['config']->get('config', 'recaptcha') == 2 && isset($_POST['g-recaptcha-response'])) { if (empty($_POST['g-recaptcha-response'])) { $recaptcha['error'] = $GLOBALS['language']->form['verify_human_fail']; } else {
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Catalogue $value A Catalogue object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Catalogue $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getCatId(); } // if key === null self::$instances[$key] = $obj; } }
foreach ($inventory as $product) { $subtotal += $product['price'] * $product['quantity']; $product['line'] = $product['price']; $price_total = $product['price'] * $product['quantity']; $product['price_total'] = number_format($price_total, 2); $product['line_formatted'] = Tax::getInstance()->priceFormat($product['price']); $product['price_total_formatted'] = Tax::getInstance()->priceFormat($price_total); $product['options'] = Catalogue::getInstance()->displayProductOptions($product['product_id'], unserialize($product['options_array'])); $product['options_array'] = false; if (!empty($product['product_options']) && preg_match('/^a:[0-9]/', $product['product_options'])) { $product['options_array'] = cc_unserialize($product['product_options']); $product['options_text'] = implode(' ', cc_unserialize($product['product_options'])); } elseif (!empty($product['product_options'])) { $product['options_text'] = $product['product_options']; } $product['line_price_less_options'] = sprintf("%.2F", $product['line'] - Catalogue::getInstance()->getOptionsLinePrice()); $smarty_data['products'][] = $product; } $GLOBALS['smarty']->assign('PRODUCTS', $smarty_data['products']); $GLOBALS['smarty']->assign('SUBTOTAL', number_format($subtotal, 2)); } // Assign summary to overview $overview_summary = $summary[0]; $overview_summary['percent'] = ''; if ($overview_summary['discount_type'] == 'p') { $overview_summary['percent'] = number_format($overview_summary['discount'] / $overview_summary['subtotal'] * 100) . '%'; } else { if ($overview_summary['discount_type'] == 'pp') { $overview_summary['percent'] = number_format($overview_summary['discount'] / ($overview_summary['subtotal'] + $overview_summary['discount']) * 100) . '%'; } }
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php include '../logic/Catalogue.php'; $catalogue = new Catalogue(); $retailerNames = $catalogue->getRetailerNames(); foreach ($retailerNames as $name) { echo $name . '<br>'; } $storeNames = $catalogue->getStoreNamesByRetailer('Sobeys'); foreach ($retailerNames as $name) { echo $name . '<br>'; } $categoryNames = $catalogue->getCategoryNames(); foreach ($retailerNames as $name) { echo $name . '<br>'; } $itemNames = $catalogue->getItemNamesByCategory('meat'); foreach ($retailerNames as $name) { echo $name . '<br>'; }
<?php $id = Url::getParam('id'); if (!empty($id)) { $objCatalogue = new Catalogue(); $product = $objCatalogue->getProduct($id); if (!empty($product)) { $category = $objCatalogue->getCategory($product['category']); require_once '_header.php'; echo "<h1>Catalogue :: " . $category['name'] . "</h1>"; $image = !empty($product['image']) ? 'media/catalogue/' . $product['image'] : null; if (!empty($image)) { $width = Helper::getImgSize($image, 0); $width = $width > 120 ? 120 : $width; echo "<div class=\"fl_l\">"; echo "<div class=\"lft\"><img src=\"{$image}\" alt=\""; echo Helper::encodeHTML($product['name'], 1); echo "\" width=\"{$width}\" /></div>"; } echo "<div class=\"rgt\"><h3>" . $product['name'] . "</h3>"; echo "<h4><strong>£" . $product['price'] . "</strong></h4>"; echo Basket::activeButton($product['id']); echo "</div></div>"; echo "<div class=\"dev\"> </div>"; echo "<p>" . Helper::encodeHTML($product['description']) . "</p>"; echo "<div class=\"dev br_td\"> </div>"; echo "<p><a href=\"javascript:history.go(-1)\">Go back</a></p>"; require_once '_footer.php'; } else { require_once 'error.php'; }
/** * List file type * * @param string $type * @param bool $select_button * @return array/false */ public function listFiles($type = false, $select_button = false) { // Display Breadcrumbs if (!empty($this->_sub_dir)) { $elements = explode('/', $this->_sub_dir); if ($elements) { foreach ($elements as $sub_dir) { $path[] = $sub_dir; $GLOBALS['gui']->addBreadcrumb($sub_dir, currentPage(null, array('subdir' => $this->formatPath(implode('/', $path), false)))); } } } $type_desc = $this->_mode == self::FM_FILETYPE_IMG ? $GLOBALS['language']->filemanager['file_type_image'] : $GLOBALS['language']->filemanager['file_type_dl']; $GLOBALS['smarty']->assign('FILMANAGER_TITLE', $type_desc . " Filemanager"); $GLOBALS['smarty']->assign('FILMANAGER_MODE', (string) $this->_mode); // Create a backlink to the parent directory, if is exists if ($this->_directories && isset($this->_directories[$this->formatPath($this->_sub_dir)])) { // List subdirectories foreach ($this->_directories[$this->formatPath($this->_sub_dir)] as $dir) { if ($this->_mode == self::FM_FILETYPE_IMG && in_array($this->makeFilename($dir), array('thumbs', 'source'))) { continue; } $name = $this->makeFilename($dir); $folder = array('name' => $name, 'link' => currentPage(null, array('subdir' => $this->formatPath($this->_sub_dir . $dir, false))), 'delete' => substr($name, 0, 1) !== '.' ? currentPage(null, array('delete' => $this->formatPath($this->_sub_dir . $dir, false))) : null); $list_folders[] = $folder; } $GLOBALS['smarty']->assign('FOLDERS', $list_folders); } $filepath_where = empty($this->_sub_dir) ? 'IS NULL' : '= \'' . str_replace('\\', '/', $this->_sub_dir) . '\''; $where = '`disabled` = 0 AND `type` = ' . (int) $this->_mode . ' AND `filepath` ' . $filepath_where; if (($files = $GLOBALS['db']->select('CubeCart_filemanager', false, $where, array('filename' => 'ASC'))) !== false) { $catalogue = new Catalogue(); $GLOBALS['smarty']->assign('ROOT_REL', $GLOBALS['rootRel']); foreach ($files as $key => $file) { $file['icon'] = $this->getFileIcon($file['mimetype']); $file['class'] = preg_match('#^image#', $file['mimetype']) ? 'class="colorbox"' : ''; $file['edit'] = currentPage(null, array('fm-edit' => $file['file_id'])); $file['delete'] = currentPage(null, array('delete' => $file['file_id'])); $file['random'] = mt_rand(); $file['description'] = !empty($file['description']) ? $file['description'] : $file['filename']; $file['master_filepath'] = str_replace(chr(92), "/", $this->_manage_dir . '/' . $file['filepath'] . $file['filename']); $file['filepath'] = $this->_mode == self::FM_FILETYPE_IMG ? $catalogue->imagePath($file['file_id'], 'medium') : $this->_manage_dir . '/' . $file['filepath'] . $file['filename']; $file['select_button'] = (bool) $select_button; if ($select_button) { $file['master_filepath'] = $GLOBALS['rootRel'] . $file['master_filepath']; } // Fix the image path added to the FCK editor area $list_files[$key] = $file; } $GLOBALS['smarty']->assign('FILES', $list_files); return $list_files; } return false; }
function getContent($args) { global $structureMgr, $templatesMgr, $authenticationMgr; $userId = $authenticationMgr->getUserID(); $userData = $authenticationMgr->getUserData($userId, ''); $userName = $userData['FirstName'] . " " . $userData['LastName']; $this->setItemData('userData', $userData); $this->setItemData('userName', $userName); $blocks = $templatesMgr->getValidTags($templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/Cart/cart.xml"), array("container", "goods", "cart", "emptycart", "order", "quickorder", "login", "comment")); $sessionID = $authenticationMgr->getSessionID(); $tpl = $blocks["container"]; $goodsline = $blocks["goods"]; $qr = mysql_query("SELECT p.sID, p.accID, p.ptID, ShortTitle, salePrice, accCount, ptPercent, p.accPlantID, logotype, p.smallPicture, s.MetaDesc, s.pms_sID, pc.PicturePath FROM pm_as_parts p \n LEFT JOIN pm_structure s ON (p.sID = s.sID) \n\t\t\t\t\t\t\t LEFT JOIN pm_as_producer ap ON (ap.accPlantID = p.accPlantID)\n LEFT JOIN pm_as_cart c ON (c.accID = p.accID)\n LEFT JOIN pm_as_pricetypes pt ON (pt.ptID = p.ptID)\n LEFT JOIN pm_as_categories pc ON (s.pms_sID = pc.sID)\n WHERE c.sessionID='{$sessionID}'"); if (!$qr) { trigger_error("Error getting cart items - \n" . mysql_error(), PM_FATAL); } $goodsCount = mysql_num_rows($qr); $goods = ""; $cardSum = 0; $curSum = 0; $sum = 0; $total = 0; if (mysql_num_rows($qr) > 0) { $cat = new Catalogue(); //goods list from $qr $goodsArray = array(); while (false !== ($r = mysql_fetch_assoc($qr))) { /* if ($catItem["ptPercent"] == 0) $firstPrice = "<strong>" . round($catItem["salePrice"] - ($catItem["salePrice"] * 5 / 100)) . "</strong>"; else $firstPrice = "<strong><font class=\"".$typeClass."\">" . round($catItem["salePrice"] - ($catItem["salePrice"] * $catItem["ptPercent"] / 100)) . "</font></strong>"; */ $gl = $goodsline; $URL = $structureMgr->getPathByPageID($r['sID'], false); $isCardInCart = Cart::isItemInCart(GetCfg('Club.GoodID')); $isClubMember = isset($userData['cardID']) && $userData['cardID'] != '0' || $isCardInCart; switch ($r['ptID']) { case 1: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * 5 / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * 5 / 100); break; case 2: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 3: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 4: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 5: $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 6: $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 7: $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; default: $curPrice = $r['salePrice']; $cardPrice = $r['salePrice']; break; } $curPrice *= $r["accCount"]; $cardPrice *= $r["accCount"]; $price = $r['salePrice'] * $r["accCount"]; //must calc as needed $priceCells = '<td class="gray"><p> <a href="%good_link%" class="bluem" target="_blank">%good_name%</a></p></td> <td><strong>%card_price%</strong></td> <td>%cur_price%</td>'; if ($isClubMember) { $priceCells = '<td>%cur_price%</td>'; } $gl = str_replace("%good_name%", $r['ShortTitle'], $gl); $gl = str_replace("%good_link%", $URL, $gl); $gl = str_replace("%card_price%", $cardPrice . " * " . $r["accCount"], $gl); $gl = str_replace("%cur_price%", $curPrice . " * " . $r["accCount"], $gl); $gl = str_replace("%price%", $price . " * " . $r["accCount"], $gl); $gl = str_replace("%good_count%", $r['accCount'], $gl); $gl = str_replace("%goodID%", $r['accID'], $gl); $cardSum += $cardPrice; $curSum += $curPrice; $sum += $price; $total += $r['accCount']; //echo "$curSum in Cart<br>"; if (file_exists(GetCfg("ROOT") . $r["PicturePath"] . "/" . $r["sID"] . ".gif")) { $r["smallPicture"] = $r["PicturePath"] . "/" . $r["sID"] . ".gif"; } else { if ($r["logotype"] == NULL) { $r["smallPicture"] = "/products/empty.gif"; } else { $r["smallPicture"] = $r["logotype"]; } } $good = new Good(array('goodID' => $r['sID'], 'good_name' => $r['ShortTitle'], 'PicturePath' => $r['PicturePath'], 'good_link' => $URL, 'card_price' => $cardPrice, 'smallPicture' => $r["smallPicture"], 'cur_price' => $curPrice, 'price' => $price, 'good_count' => $r['accCount'])); foreach ($r as $var => $val) { $good->setItemData($var, $val); } $good->setItemData('priceClass', $this->getPriceClass($r['ptID'])); $good->setItemData('ptID', $r['ptID']); $good->setItemData('ptPercent', $r['ptPercent']); $good->setItemData('props', $props = $cat->getCatItemProperties($r['sID'], "CatItem", $structureMgr->getParentPageID($r['sID']))); $this->goods[$r['sID']] = $good; $imgRes = mysql_query("SELECT accPlantName, logotype FROM pm_as_producer WHERE accPlantID = '{$r["accPlantID"]}'"); if (mysql_num_rows($imgRes) > 0) { $imgRow = mysql_fetch_assoc($imgRes); $this->goods[$r['sID']]->setItemData('accPlantName', $imgRow['accPlantName']); $this->goods[$r['sID']]->setItemData('logotype', $imgRow['logotype']); } $goods .= $gl; } $tcart = $blocks["cart"]; } else { $tcart = $blocks["emptycart"]; } if ($total > 0) { $order = $blocks["order"]; $qorder = $blocks["quickorder"]; if ($authenticationMgr->getUserID() == 1) { $blocks["login"] = str_replace("%currentpath%", getenv("REQUEST_URI"), $blocks["login"]); $order = str_replace("%right%", $blocks["login"], $order); $order = str_replace("%left%", $qorder, $order); } else { $order = str_replace("%right%", $blocks["comment"], $order); $order = str_replace("%left%", $qorder, $order); //echo $order; } } else { $order = ""; } $ret = ''; $isCardInCart = Cart::isItemInCart(GetCfg('Club.GoodID')); $isClubMember = isset($userData['cardID']) && $userData['cardID'] != '0' || $isCardInCart; $this->setItemData('isCardInCart', $isCardInCart); $this->setItemData('isClubMember', $isClubMember); $this->setItemData('userID', $userId); $this->userData = $userData; $carName = 'марка автомобиля не определена'; if ($userId > 1 && $isClubMember && $userData['carID'] != 0) { $carRow = mysql_fetch_assoc(mysql_query("SELECT * FROM pm_as_cars WHERE carID='{$userData['carID']}'")); $carName = "ВАЗ " . $carRow['carModel'] . (isset($carRow['carName']) && $carRow['carName'] != '' ? "({$carRow['carName']})" : ''); } $this->setItemData('carName', $carName); if ($userId == 1) { $ret .= '<p><strong>Внимание!:</strong></p> <p>Для вашего удобства мы предлагаем вам:</p> <p><a href="/registration" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Зарегестрироваться</a><br/> <a href="/main/club" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Стать членом клуба</a></p>'; } elseif ($userId > 1 && !$isClubMember) { $ret .= '<p><strong>Внимание:</strong></p> <p>Для вашего удобства мы предлагаем вам:</p> <a href="/main/club" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Стать членом клуба</a></p>'; } elseif ($userId > 1 && $isClubMember) { $carName = 'марка автомобиля не определена'; if ($userData['carID'] != 0) { $carRow = mysql_fetch_assoc(mysql_query("SELECT * FROM pm_as_cars WHERE carID='{$userData['carID']}'")); $carName = "ВАЗ " . $carRow['carModel'] . (isset($carRow['carName']) && $carRow['carName'] != '' ? "({$carRow['carName']})" : ''); } $ret .= '<p><strong>Здравствуйте!</strong></p> <p>' . $userName . '</p> <p>№ Вашей карты: ' . ($userData['cardID'] == '0' ? 'Будет присвоен после оплаты.' : $userData['cardID']) . '</p> <p>' . $carName . '</p> <p> <a href="#" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Изменить анкету </a> <a href="#" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Выход (log out)</a></p> '; } $club = $ret; $this->setItemData('cart', $tcart); $this->setItemData('cardsum', $cardSum); $this->setItemData('cursum', $curSum); $this->setItemData('sum', $sum); $this->setItemData('total', $total); $this->setItemData('goods', $goods); $this->setItemData('order', $order); $this->setItemData('club', $club); $dost = new Template('blockdost', $this); $this->setItemData('blockdost', $dost->getContent()); if ($userId == 1) { $header = new Template('header', 'Быстрый заказ'); $of = new Template('orderQuick'); $orderForm = $header->getContent() . $of->getContent(); } else { $header = new Template('header', 'Контактная информация'); $of = new Template('orderUser', $this->getItemData('userData')); $orderForm = $header->getContent() . $of->getContent(); } $this->setItemData('orderForm', $orderForm); $cartTpl = new Template('cart', $this); $tpl = $cartTpl->getContent(); $msg = _get("msg"); if ($msg == 1) { $msg = '<div class="podbor">Заполните пожалуйства поле "Ваше имя"</div>'; } elseif ($msg == 2) { $msg = '<div class="podbor">Заполните пожалуйства поле "Ваше имя"</div>'; } return $msg . $tpl; }
<?php $id = Url::getParam('id'); if (!empty($id)) { $objCatalogue = new Catalogue(); $product = $objCatalogue->getProduct($id); if (!empty($product)) { $objForm = new Form(); $objValid = new Validation($objForm); $categories = $objCatalogue->getCategories(); if ($objForm->isPost('name')) { $objValid->_expected = array('category', 'name', 'description', 'price'); $objValid->_required = array('category', 'name', 'description', 'price'); if ($objValid->isValid()) { if ($objCatalogue->updateProduct($objValid->_post, $id)) { $objUpload = new Upload(); if ($objUpload->upload(CATALOGUE_PATH)) { if (is_file(CATALOGUE_PATH . DS . $product['image'])) { unlink(CATALOGUE_PATH . DS . $product['image']); } $objCatalogue->updateProduct(array('image' => $objUpload->_names[0]), $id); Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited'); } else { Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited-no-upload'); } } else { Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited-failed'); } } } require_once 'template/_header.php';
<?php $cat = Url::getParam('category'); if (empty($cat)) { require_once "error.php"; } else { $objCatalogue = new Catalogue(); $category = $objCatalogue->getCategory($cat); if (empty($category)) { require_once "error.php"; } else { $rows = $objCatalogue->getProducts($cat); // instantiate paging class $objPaging = new Paging($rows, 3); $rows = $objPaging->getRecords(); require_once "_header.php"; ?> <h1>Catalogue :: <?php echo $category['name']; ?> </h1> <?php if (!empty($rows)) { foreach ($rows as $row) { ?> <div class="catalogue_wrapper"> <div class="catalogue_wrapper_left"> <?php
/** * Inject our product catalogue object into the controller * * @return ProductCatalogue */ public function getCatalogue() { return Catalogue::create(); }
<?php $id = Url::getParam('id'); if (!empty($id)) { $objCatalogue = new Catalogue(); $category = $objCatalogue->getCategory($id); if (!empty($category)) { $yes = '/admin' . Url::getCurrentUrl() . '&remove=1'; $no = 'javascript:history.go(-1)'; $remove = Url::getParam('remove'); if (!empty($remove)) { $objCatalogue->removeCategory($id); Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id', 'remove', 'srch', Paging::$_key))); } require_once 'template/_header.php'; ?> <h1>Categories :: Remove</h1> <p>Are you sure you want to remove this record?<br /> There is no undo!<br /> <a href="<?php echo $yes; ?> ">Yes</a> | <a href="<?php echo $no; ?> ">No</a></p> <?php require_once 'template/_footer.php'; } }
/** * Declares an association between this object and a Catalogue object. * * @param Catalogue $v * @return Usuario The current object (for fluent API support) * @throws PropelException */ public function setCatalogue(Catalogue $v = null) { if ($v === null) { $this->setIdIdioma(NULL); } else { $this->setIdIdioma($v->getCatId()); } $this->aCatalogue = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Catalogue object, it will not be re-added. if ($v !== null) { $v->addUsuario($this); } return $this; }
/** * returns an array of results that contain titles based on keyword metadata * * @return array */ public function seeAlsoTitles() { //check how many keywords //if keywords <= 1 then check trilogy == keyword $trilogy = array($this->video[0]->trilogy); $trilogy = array_map('strtolower', $trilogy); $array = array_diff(array_map('strtolower', $this->keywordsArr), $trilogy); //loop over values so we can create WHERE like clauses $clauses = array(); foreach ($array as $value) { $clauses[] = 'keywords LIKE \'%' . Convert::raw2sql($value) . '%\''; } if ($this->video[0]->trilogy == null && count($this->keywordsArr) > 1) { return Catalogue::get()->where(implode(' OR ', $clauses))->exclude('ID', $this->id); } if (count($this->keywordsArr) <= 1) { return false; //nothing to return so return a false so view doesn't display anything. } else { //keywords are only 1, so we will return back array of keyword results. return Catalogue::get()->where(implode(' OR ', $clauses))->exclude('trilogy', $this->video[0]->trilogy); //get all titles related to wolverine and exclude itself from result. } }
<?php $objCatalogue = new Catalogue(); $srch = Url::getParam('srch'); if (!empty($srch)) { $products = $objCatalogue->getAllProducts($srch); $empty = 'There are no results matching your searching criteria.'; } else { $products = $objCatalogue->getAllProducts(); $empty = 'There are currently no records.'; } $objPaging = new Paging($products, 5); $rows = $objPaging->getRecords(); $objPaging->_url = '/admin' . $objPaging->_url; require_once 'template/_header.php'; ?> <h1>Products</h1> <form action="" method="get"> <?php echo Url::getParams4Search(array('srch', Paging::$_key)); ?> <table cellpadding="0" cellspacing="0" border="0" class="tbl_insert"> <tr> <th><label for="srch">Product:</label></th> <td> <input type="text" name="srch" id="srch" value="<?php echo stripslashes($srch);
<?php // If subsites is installed if (class_exists('Subsite')) { CatalogueProduct::add_extension('SubsiteCatalogueExtension'); CatalogueCategory::add_extension('SubsiteCatalogueExtension'); TaxRate::add_extension('SubsiteCatalogueExtension'); CatalogueAdmin::add_extension('SubsiteMenuExtension'); } // Setup google sitemaps $catalogue_enabled = Catalogue::config()->enable_frontend; if ($catalogue_enabled && class_exists("GoogleSitemap")) { GoogleSitemap::register_dataobject('CatalogueProduct'); GoogleSitemap::register_dataobject('CatalogueCategory'); }
/** * Dynamic template load * * @param string $type * @param string $search_string * @return data/false */ public static function template($type, $search_string) { switch (strtolower($type)) { case 'prod_options': $options['options'] = Catalogue::getInstance()->displayProductOptions($search_string); $GLOBALS['smarty']->assign('product', $options); die($GLOBALS['smarty']->fetch('templates/element.product_options.php')); break; } return false; }
public function reactCatalogue() { $id = Input::get('reactID'); $isAdded = FALSE; if (!$isAdded) { $catalogue = Catalogue::find($id); $reas = Input::get('reactInactiveCatalogue'); $reason = DB::table('tblReasonCatalogue')->where('strInactiveCatalogueID', '=', $reas)->delete(); $catalogue->boolIsActive = 1; $catalogue->save(); return Redirect::to('/utilities/inactiveData?successRec=true'); } else { return Redirect::to('/utilities/inactiveData?successRec=false'); } }
$GLOBALS['main']->addTabControl($lang['catalogue']['title_manufacturer'], false, currentPage(array('edit'))); $GLOBALS['main']->addTabControl($lang['catalogue']['title_manufacturer_edit'], 'manu_edit'); if (($manufacturers = $GLOBALS['db']->select('CubeCart_manufacturers', array('name', 'id', 'URL'), array('id' => (int) $_GET['edit']))) !== false) { $GLOBALS['smarty']->assign('EDIT', $manufacturers[0]); } else { $GLOBALS['main']->setACPWarning($lang['catalogue']['error_manufacturer_found']); httpredir(currentPage(array('edit'))); } foreach ($GLOBALS['hooks']->load('admin.product.manufacturer.tabs') as $hook) { include $hook; } $GLOBALS['smarty']->assign('PLUGIN_TABS', $smarty_data['plugin_tabs']); $GLOBALS['smarty']->assign('DISPLAY_FORM', true); } else { $GLOBALS['main']->addTabControl($lang['catalogue']['title_manufacturer'], 'manufacturers'); $GLOBALS['main']->addTabControl($lang['catalogue']['title_manufacturer_add'], 'manu_add'); $catalogue = Catalogue::getInstance(); $page = isset($_GET['page']) ? $_GET['page'] : 1; $per_page = 10; if (($manufacturers = $GLOBALS['db']->select('CubeCart_manufacturers', false, false, 'name', $per_page, $page)) !== false) { $GLOBALS['smarty']->assign('PAGINATION', $GLOBALS['db']->pagination(false, $per_page, $page)); foreach ($manufacturers as $i => $manufacturer) { if (filter_var($manufacturer['URL'], FILTER_VALIDATE_URL)) { $manufacturers[$i]['name'] = '<a href="' . $manufacturer['URL'] . '" target="_blank">' . $manufacturer['name'] . '</a>'; } } $GLOBALS['smarty']->assign('MANUFACTURERS', $manufacturers); } $GLOBALS['smarty']->assign('DISPLAY_LIST', true); } $page_content = $GLOBALS['smarty']->fetch('templates/products.manufacturers.php');
<?php Login::restrictFront(); $token1 = mt_rand(); $token2 = Login::string2hash($token1); Session::setSession('token2', $token2); $objBasket = new Basket(); $out = array(); $session = Session::getSession('basket'); if (!empty($session)) { $objCatalogue = new Catalogue(); foreach ($session as $key => $value) { $out[$key] = $objCatalogue->getProduct($key); } } require_once "_header.php"; ?> <h1>Order summary</h1> <?php if (!empty($out)) { ?> <div id="big_basket"> <form action="" method="post" id="frm_basket"> <table cellpadding="0" cellspacing="0" border="0" class="tbl_repeat"> <tr>
<?php $id = Url::getParam('id'); if (!empty($id)) { $objOrder = new Order(); $order = $objOrder->getOrder($id); if (!empty($order)) { $items = $objOrder->getOrderItems($id); $objCatalogue = new Catalogue(); $objUser = new User(); $user = $objUser->getUser($order['client']); $objCountry = new Country(); $objBusiness = new Business(); $business = $objBusiness->getBusiness(); $objBasket = new Basket(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Invoice</title> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta http-equiv="imagetoolbar" content="no" /> <link href="/css/invoice.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper">