예제 #1
0
파일: product.php 프로젝트: nellka/mebel
 function __construct()
 {
     $model = new Models_Product();
     // Требуется только пересчет цены товара.
     if (!empty($_REQUEST['calcPrice'])) {
         $model->calcPrice();
         exit;
     }
     $product = Storage::get(md5('ControllersProduct' . URL::getUrl()));
     if ($product == null) {
         $settings = MG::get('settings');
         $product = $model->getProduct(URL::getQueryParametr('id'));
         if (empty($product)) {
             MG::redirect('/404');
             exit;
         }
         $product['meta_title'] = $product['meta_title'] ? $product['meta_title'] : $product['title'];
         $product['currency'] = $settings['currency'];
         $blockVariants = $model->getBlockVariants($product['id']);
         $blockedProp = $model->noPrintProperty();
         $propertyFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => $product['thisUserFields'], 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => $blockedProp, 'noneAmount' => false, 'noneButton' => $product['count'] ? false : true, 'titleBtn' => MG::getSetting('buttonBuyName'), 'blockVariants' => $blockVariants, 'currency_iso' => $product['currency_iso']));
         // Легкая форма без характеристик.
         $liteFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => null, 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => $blockedProp, 'noneAmount' => false, 'noneButton' => $product['count'] ? false : true, 'titleBtn' => MG::getSetting('buttonBuyName'), 'blockVariants' => $blockVariants));
         //echo viewData($propertyFormData['defaultSet']);
         $product['price_course'] += $propertyFormData['marginPrice'];
         $currencyRate = MG::getSetting('currencyRate');
         $currencyShopIso = MG::getSetting('currencyShopIso');
         $product['currency_iso'] = $product['currency_iso'] ? $product['currency_iso'] : $currencyShopIso;
         $product['old_price'] = $product['old_price'] * $currencyRate[$product['currency_iso']];
         $product['old_price'] = $product['old_price'] ? $product['old_price'] : 0;
         $product['price'] = MG::priceCourse($product['price_course']);
         $product['propertyForm'] = $propertyFormData['html'];
         $product['propertyNodummy'] = $propertyFormData['propertyNodummy'];
         $product['stringsProperties'] = $propertyFormData['stringsProperties'];
         $product['liteFormData'] = $liteFormData['html'];
         $product['description'] = MG::inlineEditor(PREFIX . 'product', "description", $product['id'], $product['description']);
         $product['title'] = MG::modalEditor('catalog', $product['title'], 'edit', $product["id"]);
         // Информация об отсутствии товара на складе.
         if (MG::getSetting('printRemInfo') == "true") {
             $message = 'Здравствуйте, меня интересует товар "' . str_replace("'", """, $product['title']) . '" с артикулом "' . $product['code'] . '", но его нет в наличии.
     Сообщите, пожалуйста, о поступлении этого товара на склад. ';
             if ($product['count'] != 0) {
                 $style = 'style="display:none;"';
             }
             $product['remInfo'] = "<span class='rem-info' " . $style . ">Товара временно нет на складе!<br/><a href='" . SITE . "/feedback?message=" . $message . "'>Сообщить когда будет в наличии.</a></span>";
         }
         if ($product['count'] < 0) {
             $product['count'] = "много";
         }
         $product['related'] = $model->createRelatedForm($product['related']);
         Storage::save(md5('ControllersProduct' . URL::getUrl()), $product);
     }
     // MG::set('propertyNodummy',$product['propertyNodummy']);
     // $_SESSION['propertyNodummy'] = $product['propertyNodummy'];
     $this->data = $product;
 }
예제 #2
0
 static function breadcrumbs()
 {
     $breadcrumbs = Storage::get(md5('breadcrumbs' . URL::getUrl()));
     if ($breadcrumbs == null) {
         $sections = URL::getSections();
         array_splice($sections, 0, 1);
         if (SHORT_LINK == 1 && MG::get('controller') == 'controllers_product') {
             $product_url = URL::getLastSection();
             $res = DB::query('SELECT CONCAT(c.`parent_url`, c.`url`) as fullurl
       FROM `' . PREFIX . 'product` p LEFT JOIN `' . PREFIX . 'category` c 
       ON p.cat_id  = c.id WHERE p.url = ' . DB::quote($product_url));
             $cat = DB::fetchArray($res);
             $sections = explode('/', $cat['fullurl']);
             $sections[] = $product_url;
         }
         $breadcrumbs = '<a href="' . SITE . '/catalog">Каталог</a>';
         $max = count($sections);
         $i = 0;
         $par = '';
         foreach ($sections as $section) {
             $url = $section;
             $cat = 'title';
             if ($url != 'catalog') {
                 $data = self::checkURLname('*', 'category', $section, 'url', $par);
                 $url = $data[0]['parent_url'] . $section;
                 $res = $data[0]['title'];
                 $par = $data[0]['id'];
                 if (!$data[0]['title']) {
                     $cat = 'name';
                     $n = '';
                     $result = self::checkURLname('*', 'product', $section, 'url', $n);
                     $url = $data[0]['parent_url'] . $sections[1] . '/' . $sections[2];
                     $categoryRes = self::checkURLname('url, parent_url', 'category', $result[0]['cat_id'], 'id');
                     $url = $categoryRes[0]['parent_url'] . $categoryRes[0]['url'] . '/' . $result[0]['url'];
                     $res = $result[0]['title'];
                 }
             }
             $i++;
             if ($max == $i) {
                 $breadcrumbs .= ' » <span class="last-crumb">' . $res . '</span>';
             } else {
                 $breadcrumbs .= ' » <a href="' . SITE . '/' . $url . '">' . $res . '</a>';
             }
         }
         $breadcrumbs = "<div class='bread-crumbs'>" . $breadcrumbs . "</div>";
         //сохраняем объект в кэш
         Storage::save(md5('breadcrumbs' . URL::getUrl()), $breadcrumbs);
     }
     return $breadcrumbs;
 }
예제 #3
0
 function __construct()
 {
     $this->msg = "";
     $paymentID = URL::getQueryParametr('id');
     $paymentStatus = URL::getQueryParametr('pay');
     $_POST['url'] = URL::getUrl();
     $modelOrder = new Models_Order();
     switch ($paymentID) {
         case 1:
             //webmoney
             $msg = $this->webmoney($paymentID, $paymentStatus);
             break;
         case 5:
             //robokassa
             $msg = $this->robokassa($paymentID, $paymentStatus);
             break;
         case 6:
             //qiwi
             $msg = $this->qiwi($paymentID, $paymentStatus);
             break;
         case 8:
             //interkassa
             $msg = $this->interkassa($paymentID, $paymentStatus);
             break;
         case 2:
             //ЯндексДеньги
             $msg = $this->yandex($paymentID, $paymentStatus);
             break;
         case 9:
             //PayAnyWay
             $msg = $this->payanyway($paymentID, $paymentStatus);
         case 10:
             //PayMastert
             $msg = $this->paymaster($paymentID, $paymentStatus);
             break;
         case 11:
             //alfabank
             $msg = $this->alfabank($paymentID, $paymentStatus);
             break;
         case 14:
             //Яндекс.Касса
             $msg = $this->yandexKassa($paymentID, $paymentStatus);
             break;
         case 15:
             //privat24
             $msg = $this->privat24($paymentID, $paymentStatus);
             break;
     }
     $this->data = array('payment' => $paymentID, 'status' => $paymentStatus, 'message' => $msg);
 }
예제 #4
0
파일: index.php 프로젝트: WinGood/24karcher
 static function breadcrumbs()
 {
     $breadcrumbs = Storage::get(md5('breadcrumbs' . URL::getUrl()));
     if ($breadcrumbs == null) {
         $sections = URL::getSections();
         array_splice($sections, 0, 1);
         $breadcrumbs = '<a href="' . SITE . '/catalog">Каталог</a>';
         $max = count($sections);
         $i = 0;
         $par = '';
         foreach ($sections as $section) {
             $url = $section;
             $cat = 'title';
             if ($url != 'catalog') {
                 $data = self::checkURLname('*', 'category', $section, 'url', $par);
                 $url = $data[0]['parent_url'] . $section;
                 $res = $data[0]['title'];
                 $par = $data[0]['id'];
                 if (!$data[0]['title']) {
                     $cat = 'name';
                     $n = '';
                     $result = self::checkURLname('*', 'product', $section, 'url', $n);
                     $url = $data[0]['parent_url'] . $sections[1] . '/' . $sections[2];
                     $categoryRes = self::checkURLname('url, parent_url', 'category', $result[0]['cat_id'], 'id');
                     $url = $categoryRes[0]['parent_url'] . $categoryRes[0]['url'] . '/' . $result[0]['url'];
                     $res = $result[0]['title'];
                 }
             }
             $i++;
             if ($max == $i) {
                 $breadcrumbs .= ' » <span class="last-crumb">' . $res . '</span>';
             } else {
                 $breadcrumbs .= ' » <a href="' . SITE . '/' . $url . '">' . $res . '</a>';
             }
         }
         $breadcrumbs = "<div class='bread-crumbs'>" . $breadcrumbs . "</div>";
         //сохраняем объект в кэш
         Storage::save(md5('breadcrumbs' . URL::getUrl()), $breadcrumbs);
     }
     return $breadcrumbs;
 }
예제 #5
0
파일: url.php 프로젝트: nellka/mebel
 /**
  * Вовзращает массив составных частей ссылки.
  * @return type
  */
 public static function getDataUrl($url = false)
 {
     if (!$url) {
         $url = URL::getUrl();
     }
     return parse_url($url);
 }
예제 #6
0
<ul class="top-menu-list">
<?php 
foreach ($data['pages'] as $page) {
    ?>
 
  <?php 
    if ($page['invisible'] == "1") {
        continue;
    }
    ?>
  <?php 
    if (URL::getUrl() == $page['link'] || URL::getUrl() == $page['link'] . '/') {
        $active = 'active';
    } else {
        $active = '';
    }
    ?>
	<?php 
    if (isset($page['child'])) {
        ?>
    <?php 
        /** если все вложенные страницы неактивны, то не создаем вложенный список UL */
        $slider = 'slider';
        $noUl = 1;
        foreach ($page['child'] as $pageLevel1) {
            $noUl *= $pageLevel1['invisible'];
        }
        if ($noUl) {
            $slider = '';
        }
        ?>
예제 #7
0
파일: url.class.php 프로젝트: Kjir/amsn
 function redirect_nohtml($link, $extra = array())
 {
     $url = new URL();
     $url->initCurURL();
     //$url->clean();
     $url->setGet($key, $link);
     foreach ($extra as $key => $value) {
         $url->setGet($key, $value);
     }
     return $url->getUrl(false);
 }