Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Turn Off Cache Of Perticular Tpl Rate Topic   - - - - -

 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 08 March 2016 - 11:23 AM #1

Hello ,

 

I want to stop cache of a particular tpl file , can anyone suggest me how can stop that caching.

 

problem : i was created a popup that hold dynamic value . so its works for first time , as cache created it not shows change value . when we go to congiq.local & disable_block_cache = true then its works .

 

so please suggest me alternative way to achieve this issue .

 

i hope i will get a answer :)

 

 


Vivek Gupta 
 


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 08 March 2016 - 09:58 PM #2

Caching is probably not your problem.  If you are properly passing the smarty variables to the template, it is only the template structure that is cached, not the values.  If you are using a block then you might have issues depending on how you've setup the block.  But just a normal template should utilize the smarty values passed from the controller.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19764 posts

Posted 09 March 2016 - 08:25 AM #3

For example, to disable cache for the blocks with Smarty support, please open the app/schemas/block_manager/blocks.php file and replace:

'smarty_block' => array(        
        'content' => array(
            'content' => array(
                'type' => 'simple_text',
                'required' => true,
            )
        ),
        'templates' => 'blocks/smarty_block.tpl',
        'wrappers' => 'blocks/wrappers',
        'multilanguage' => true,
        'cache' => true
    ),

with

'smarty_block' => array(        
       'content' => array(
            'content' => array(
                'type' => 'simple_text',
                'required' => true,
            )
        ),
        'templates' => 'blocks/smarty_block.tpl',
        'wrappers' => 'blocks/wrappers',
        'multilanguage' => true,
        'cache' => false
    ),

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 09 March 2016 - 12:05 PM #4

thanks all.

 

 

 

Caching is probably not your problem.  If you are properly passing the smarty variables to the template, it is only the template structure that is cached, not the values.  If you are using a block then you might have issues depending on how you've setup the block.  But just a normal template should utilize the smarty values passed from the controller.

you just go in in my_changes, open func.php & write.

function test_time()

{

    return TIME;

 

& call this function in products/qty.post.tpl (tpl hook)

{assign var=my_test value=test_time()}

{fn_print_r(my_test)}

 

 

you will get first time refresh(after cache clear) timestamp at each refresh. please try it & suggest me a solution .

 

 

For example, to disable cache for the blocks with Smarty support, please open the app/schemas/block_manager/blocks.php file and replace:

'smarty_block' => array(
'content' => array(
'content' => array(
'type' => 'simple_text',
'required' => true,
)
),
'templates' => 'blocks/smarty_block.tpl',
'wrappers' => 'blocks/wrappers',
'multilanguage' => true,
'cache' => true
),

with

'smarty_block' => array(
'content' => array(
'content' => array(
'type' => 'simple_text',
'required' => true,
)
),
'templates' => 'blocks/smarty_block.tpl',
'wrappers' => 'blocks/wrappers',
'multilanguage' => true,
'cache' => false
),

 

Thanks Ecom . i read it at this link http://forum.cs-cart...locks-or-parts/ but i thing its for work block cache . but in my issue here is a simple tpl file . I expained replication of issue please read that & provide me a solution.

it will be a great help for me.\


Vivek Gupta 
 


 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 10 March 2016 - 06:05 AM #5

I'm not getting answer . No one here to help .

:-(  


Vivek Gupta 
 


 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 10 March 2016 - 02:32 PM #6

No Answer ....

Please get this demo installer & give a solution.


Vivek Gupta 
 


 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 15 March 2016 - 02:21 PM #7

{nocache}{/nocache}  also not working .


Vivek Gupta 
 


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 15 March 2016 - 07:44 PM #8

But if you're using smarty variables for the content (rather than just rewriting data to a file/template) then cache or no-cache will still resolve those variables.  The variable values are NOT cached, only the template code itself.

 

Can you explain in more detail what you pop-up contains that you need it to not be cached?


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 16 March 2016 - 02:32 PM #9

Thanks tbirnseth

 

At least you are intrested in my issue . please get attached zip(my problem.zip) in above thread. you install it & when you will check product detail page , there i/m printion only current timestamp . timesatmp value cached not pick dynamic value each time


Vivek Gupta 
 


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19764 posts

Posted 16 March 2016 - 03:14 PM #10

At least you are intrested in my issue . please get attached zip(my problem.zip) in above thread. you install it & when you will check product detail page , there i/m printion only current timestamp . timesatmp value cached not pick dynamic value each time

We can help you. But this work will take time. We can examine it on the paid basis, if you are interested. I think, Tony will agree with me


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 16 March 2016 - 04:02 PM #11

Thanks Ecom,

 

but i'm not interested to pay, we really you think this is issue & you are interested then join me else leave me . :) 


Vivek Gupta 
 


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 17 March 2016 - 01:13 AM #12

Sorry, but I can't invest in setting up a site to install something from someone I know nothing about to evaluate a problem that can't seem to be articulated.

 

If you can provide a test version of your template (small amount of code that demonstrates the problem you're having), I'm happy to review and give feedback.

 

If you're not able to either articulate the problem in text or provide a small example, I'm not able to help you either.  I explained that if variables of non-cached data are used within your template/block that those real-time template variables will be used to alter the data within your template.

 

Remember, that many of us contribute our time here.  We also run businesses that are based on consulting/development/troubleshooting.  We're generally happy to help and Ecom is usually willing to go deeper than I in helping people.  So I think your comment to them was quite rude and uncalled for.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 17 March 2016 - 10:56 AM #13

Hello tbirnseth

 

thanks .

 

Product.post.php in my changes 

if($mode == 'view')
{
	Registry::get('view')->assign('my_test_time',TIME);
}

Tpl hook : in my changes (qty.post.tpl)

<b>{nocache}{$my_test_time}{/nocache}</b>

Outout :  1458211312 (first load)

               1458211312 (same  , but it shuld be dynamic)

 

its load from cache every time so how can get dynamic value. each time (how to skip cache of perticaular file)

 

 

 

 

Remember, that many of us contribute our time here.  We also run businesses that are based on consulting/development/troubleshooting.  We're generally happy to help and Ecom is usually willing to go deeper than I in helping people.  So I think your comment to them was quite rude and uncalled for.

 

yes i know Ecom works very well here & each time i'm appreciating that effort but my friend this is knowledge base forum , where everyone want to share issue & finding a solution , This is not a business place  . So please you all of doing well & keep it . But please don't convert this knowledge-base in to business center.

& again really i'm appreciate the effort of all ,who really want to do help .  


Vivek Gupta 
 


 
  • add1ctiv3
  • Newbie
  • Trial users
  • Join Date: 23-Sep 18
  • 3 posts

Posted 28 August 2019 - 07:33 PM #14

Hello, I am also facing the same problem.

 

I have this tpl hook ---> product_multicolumns_list.pre.tpl

 

There I have this code

{nocache}
{if $product && $product.product_id}
{$ribbon = get_products_promo_ribbon($product.product_id)}
{/if}

{if $ribbon && $image_data && $ribbon.is_visible == "Y" && strpos($image_data.absolute_path, "detailed") && !strpos($image_data.absolute_path, "thumbnails") && $image_data.width > $ribbon.container_width}
    <div class="promo_ribbon_container" style="width:{$ribbon.container_width}px; height:{$ribbon.container_width}px;">
        <div class="promo_ribbon" style="background-color:{$ribbon.ribbon_color}; font-size: {$ribbon.ribbon_label_font_size}px;
                width:{$ribbon.ribbon_width}px; height: {$ribbon.ribbon_height}px; left:-{$ribbon.ribbon_left}px;
                top:{$ribbon.ribbon_top}px; ">
            {$ribbon.ribbon_label}
        </div>
    </div>
{/if}
{/nocache}

This will add a ribbon on the top left corner of a product image. When i have automatic cache rebuild enabled its working as intended. But I turn it off the ribbon is shown even if $ribbon.is_visible == "N" which is obviously wrong. You can turn this var to Y and N from the backend control panel of the addon i m developing.

 

Is there a way to exclude this tpl from the cache (nocache is not working), or am I doing something wrong here?