Перейти к содержанию
Официальный форум поддержки Simpla

snake

Пользователь
  • Публикаций

    15
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные snake

  1. Существует категория (Заголовок, текст с ОПИСАНИЕМ, товары)

    В товарах рейтинг есть

    Нужна возможность оценивать не только товары в категории, но и ОПИСАНИЕ самой категории (после заголовка прилепить рейтинг), т.е. саму категорию

  2. Экстрасенсы в отпуске! Нужно больше конкретики.

    На сайте есть звездный рейтинг выполненный по данным инструкциям и он работает, но мне нужно чтобы была возможность оценки не только товаров в категории, но и самой категории.

  3. Подскажите как сделать запись

    if($('.variants').find('input[name=variant]:checked').size()>0) 
     variant = $('.variants input[name=variant]:checked').val();
    if($('.variants').find('select[name=variant]').size()>0)
     variant = $('.variants').find('select').val();
    

     

    если переменная variant не определена (у варианта нет имени )

    кусок кода product.tpl:

    <form action="cart" class="variations_form cart variants">
    
    	<table class="variations" style='{if $product->variants|count==1  && !$product->variant->name}display:none;{/if}'>
    		<tbody>
    							<tr>
    					<td class="value">
    			<!-- Выбор варианта товара -->
    			{* Не показывать выбор варианта, если он один и без названия *}
    			<select name="variant">
    				{foreach $product->variants as $v}
    				
                    {if $v|count==1  && !$v->name}
                    {else}
                    <option value="{$v->id}" {if $v->compare_price > 0}compare_price="{$v->compare_price|convert}"{/if}  {if $v->stock}data-stock="{$v->stock}"{/if} data-price="{$v->price|convert}">
    				{$v->name}
    				</option>
    				{/if}
                    {/foreach}
    			</select>
    			<!-- Выбор варианта товара (The End) -->
         
                                 </td>
    				</tr>
    	        		</tbody>
    	</table>
    
    
    	<div class="single_variation_wrap" style="">
    		
    		<div class="variations_button">
    			<div class="added">
    			<input type="button" value="-" class="min">
    			<input type="number" step="1" name="amount" value="1" title="Количество" class="quantity">
    			<input type="button" value="+" class="pl"></div>
    			<button type="submit" class="button">В корзину</button>
    		</div>
    	
    	
    	
    	 <a href="#oneclick" class="button various oneclick">Купить в 1 клик</a>
    	
    	
    	
    	</div>
     <div class="stock">     
    <link itemprop="availability" href="http://schema.org/InStock" />{if $v->stock}В наличии{else}Под заказ{/if}     
    </div> 	
    </form>
    
    <script>
    {literal}
    jQuery(function() {
    
    	// Выбор вариантов
    	jQuery('select[name=variant]').change(function() {
    		price = jQuery(this).find('option:selected').attr('data-price');
    		compare_price = '';
    		if(typeof jQuery(this).find('option:selected').attr('compare_price') == 'string')
    			compare_price = jQuery(this).find('option:selected').attr('compare_price');
    		stock = '';
    		if(typeof jQuery(this).find('option:selected').attr('data-stock') == 'string')
    			stock = jQuery(this).find('option:selected').attr('data-stock');
    		jQuery(this).find('option:selected').attr('compare_price');
    		jQuery(this).closest('.resume').find('span.price').html(price);
    		jQuery(this).closest('.resume').find('span.old').html(compare_price);
    		jQuery(this).closest('form').find('span.stock').html(stock);
    		return false;
    	});
    		
    });
    </script>
    {/literal} 
    
  4. Попробуйте с вложения.

    Если не поможет то полагаю что он теряется при редиректе.

    Нужно будет поэкспериментировать...

    Спасибо, разобрался.

    Изначально в файле .htaccess допустил ошибку. Вместо этих двух редиректов:

    # Редирект https
    RewriteBase /
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    RewriteCond %{HTTP_HOST} ^www\.(.*)$
    RewriteRule ^(.*)$ https://%1/$1 [L,R=301]
    

     

    надо было писать следующее:

    # Редирект https и с www на без www
    RewriteBase /
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} ^www\.
    RewriteRule (.*) https://site.ru/$1 [L,R=301]
    

     

    Хотя сервис на котором проверял :

    http://last-modified.com/ru/if-modified-since.html

    определяет некорректно заголовки и на нем они и сейчас почему-то не проходят, хотя при проверке здесь:

    www.tools.seo-​auditor.ru/if-modified-since/

    все ок

  5. файл .htaccess

    AddDefaultCharset UTF-8
    ErrorDocument 404 /404
    ErrorDocument 401 /password.php
    RewriteEngine on
    
    # Редирект https
    RewriteBase /
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    RewriteCond %{HTTP_HOST} ^www\.(.*)$
    RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
    
    # Админка теперь по адресу /simpla
    RewriteRule    ^admin/?$  simpla [L]
    
    
    # Каталог товаров
    RewriteRule ^catalog/([^/]+)/?$    index.php?module=ProductsView&category=$1 [L,QSA]
    RewriteRule ^catalog/([^/]+)/([^/]+)/?$    index.php?module=ProductsView&category=$1&brand=$2 [L,QSA]
    
    RewriteRule ^products/([^/]+)/?$    index.php?module=ProductView&product_url=$1 [L,QSA]
    RewriteRule ^products/?$    index.php?module=ProductsView [L,QSA]
    
    RewriteRule ^brands/([^/]+)/?$    index.php?module=ProductsView&brand=$1 [L,QSA]
    RewriteRule ^brands/([^/]+)/page_([^/]+)/?$    index.php?module=ProductsView&brand=$1&page=$2 [L,QSA]
    
    # Поиск товаров
    RewriteRule ^search/([^/]+)/?$    index.php?module=ProductsView&keyword=$1 [L,QSA]
    RewriteRule ^search/?$    index.php?module=ProductsView [L,QSA]
    
    # Блог
    RewriteRule ^blog/([^/]+)/?$    index.php?module=BlogView&url=$1 [L,QSA]
    RewriteRule ^blog/?$    index.php?module=BlogView [L,QSA]
    
    # Корзина и заказы
    RewriteRule ^cart/?$    index.php?module=CartView   [L,QSA]
    RewriteRule ^cart/([^/]+)/?$    index.php?module=CartView&add_variant=$1  [L,QSA]
    RewriteRule ^cart/remove/([^/]+)/?$    index.php?module=CartView&delete_variant=$1  [L,QSA]
    RewriteRule ^order/([^/]+)/?$    index.php?module=OrderView&url=$1  [L,QSA]
    RewriteRule ^order/?$    index.php?module=OrderView  [L,QSA]
    
    # Для пользователей
    RewriteRule ^user/login/?$    index.php?module=LoginView  [L,QSA]
    RewriteRule ^user/register/?$    index.php?module=RegisterView  [L,QSA]
    RewriteRule ^user/logout/?$    index.php?module=LoginView&action=logout  [L,QSA]
    RewriteRule ^user/password_remind/?$    index.php?module=LoginView&action=password_remind  [L,QSA]
    RewriteRule ^user/password_remind/([0-9a-z]+)/?$    index.php?module=LoginView&action=password_remind&code=$1  [L,QSA]
    RewriteRule ^user/?$    index.php?module=UserView  [L,QSA]
    
    # Статьи
    RewriteRule ^articles/([^/]+)/?$    index.php?module=ArticlesView&category=$1 [L,QSA]
    RewriteRule ^articles/?$    index.php?module=ArticlesView [L,QSA]
    RewriteRule ^article/([^/]+)/?$    index.php?module=ArticlesView&article_url=$1 [L,QSA]
    RewriteRule ^article/?$	index.php?module=ArticleView [L,QSA]
    
    # Google sitemap
    RewriteRule ^sitemap.xml?$    sitemap.php  [L,QSA]
    
    # XML
    RewriteRule ^yandex.xml?$    yandex.php  [L,QSA]
    
    # feedback
    RewriteRule ^contact/?$    index.php?module=FeedbackView  [L,QSA]
    
    #downloads
    RewriteRule ^order/([^/]+)/([^/]+)/?$    index.php?module=OrderView&url=$1&file=$2  [L,QSA]
    
    
    # Статические страницы
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]*)/?$    index.php?module=PageView&page_url=$1 [L,QSA]
    RewriteRule ^/?$    index.php?module=MainView&page_url= [L,QSA]
    
    # Ресайз картинок на лету
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^files/products/(.+) resize/resize.php?file=$1&token=%{QUERY_STRING}
    #RewriteCond %{THE_REQUEST} ^GET\ (.*)files/products/(.*)\?([A-z0-9]*) 
    #RewriteRule ^files/products/(.+) resize/resize.php?file=%2&token=%3 [L,NE]
    
    # Ресайз картинок на лету
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^files/articles/(.+) resize/resizeart.php?file=$1&token=%{QUERY_STRING}
    #RewriteCond %{THE_REQUEST} ^GET\ (.*)files/articles/(.*)\?([A-z0-9]*) 
    #RewriteRule ^files/articles/(.+) resize/resizeart.php?file=%2&token=%3 [L,NE]
    
    RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
    RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]
    
    
    <ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    </ifModule>
    
    <IfModule mod_headers.c>
     <FilesMatch "\.(js|css|xml|gz)$">
       Header append Vary: Accept-Encoding
     </FilesMatch>
    </IfModule>
    
    ### 1. Обработка js-файлов
    <FilesMatch «\.js.gz$«>
    ForceType text/javascript
    Header set Content-Encoding: gzip
    </FilesMatch>
    <FilesMatch «\.js$„>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} !“.*Safari.*»
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule (.*)\.js$ $1\.js.gz [L]
    ForceType text/javascript
    </FilesMatch>
    
    # Включаем кэш в браузерах посетителей
    <IfModule mod_expires.c>
      <FilesMatch \.(gif|png|jpg|jpeg|ogg|mp4|mkv|flv|swf|wmv|asf|asx|wma|wax|wmx|wm|woff)$>
        ExpiresDefault "access plus 1 year"
      </FilesMatch>
      ExpiresActive on
      ExpiresByType image/jpeg "access plus 7 day"
      ExpiresByType image/gif "access plus 7 day"
      ExpiresByType image/png "access plus 7 day"
      <FilesMatch \.(css|js)$>
        ExpiresDefault "access plus 1 year"
      </FilesMatch>
      ExpiresByType text/css "access plus 1 year"
      ExpiresByType application/javascript "access plus 1 year"
    </IfModule>
    
    # сжатие text, html, javascript, css, xml:
    <ifModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
    </ifModule>
    
    
    

     

    при работе без SSL сертификата все работало хорошо, да и сейчас все остальное работает хорошо, кроме Last-Modified

  6. При использовании https соединения заголовки Last-Modified не отдаются

    в .htaccess прописано:

    # Редирект https
    RewriteBase /
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    

    Изначально при использовании http соединения​ в index.php было прописано:

    // Если все хорошо
    if(($res = $view->fetch()) !== false)
    {
    
    	// Выводим результат
    	header("Content-type: text/html; charset=UTF-8");
    
        $LastModified_unix = strtotime($view->last_update); // время последнего изменения страницы
    
        if(!empty($LastModified_unix) && $LastModified_unix > 0)
        {
            $LastModified = gmdate("D, d M Y H:i:s \G\M\T", $LastModified_unix);
            $IfModifiedSince = false;
            if (isset($_ENV['HTTP_IF_MODIFIED_SINCE']))
                $IfModifiedSince = strtotime(substr($_ENV['HTTP_IF_MODIFIED_SINCE'], 5));
            if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
                $IfModifiedSince = strtotime(substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 5));
            if ($IfModifiedSince && $IfModifiedSince >= $LastModified_unix) {
                header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
            }
            header('Last-Modified: '. $LastModified);
        }
    
    	print $res;
    

     

     

    и все работало корректно.

    Подскажите, где может быть проблема

     

×
×
  • Создать...