Jump to content

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

Caching Issue Rate Topic   - - - - -

 
  • Brownleather
  • Junior Member
  • Members
  • Join Date: 06-Jan 10
  • 51 posts

Posted 04 December 2017 - 10:22 PM #1

I'm making an add-on which adds a condition to the catalog promotions that will enable a user to have a promotion activate if the URL contains a given value.

 

I'm running into a caching issue...

 

When accessing a page with the special value in the URL, (and  there is already a cached version of the page) the system serves the cached version which shows the regular price (not the promo price). 

 

When accessing a page with the special value in the URL (and there is no cached version of the given page) the promo price is shown correctly, but thereafter, the page will continue the show the promo pricing even when the page is accessed without the special value in the URL.

 

The issue dose not occur when "Rebuild cache automatically" is on or when testing with users logged in. 

 

How can we avoid caching and using caches when the promotion is applied?

 

Many thanks



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

Posted 04 December 2017 - 10:49 PM #2

Are you using a 3rd party caching mechanism? Csc cache only caches layout, not data.

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.


 
  • Brownleather
  • Junior Member
  • Members
  • Join Date: 06-Jan 10
  • 51 posts

Posted 04 December 2017 - 11:54 PM #3

Are you using a 3rd party caching mechanism? Csc cache only caches layout, not data.

 

I'm using the default setup ($config['cache_backend'] = 'file') no 3rd party caching mechanism.

Why do you say that "Csc cache only caches layout, not data" see "/var/cache/registry/block_content_main_products.view/", it clearly has product data?



 
  • Brownleather
  • Junior Member
  • Members
  • Join Date: 06-Jan 10
  • 51 posts

Posted 05 December 2017 - 12:05 AM #4

I know I can set 'disable_block_cache' => true but I'm wondering if there is a way to force the system to load a given page fresh (not from the cache) (to use when a promo URL is detected) and also have the system not cache a given page (when a promo ULR is used)

 

It seems that logged in used already use such functionality (promos that depend on a user group, for example, are only severed to the given user without any caching issues).



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

Posted 05 December 2017 - 01:41 AM #5

Why do you say that "Csc cache only caches layout, not data" see "/var/cache/registry/block_content_main_products.view/", it clearly has product data?

 
I thought you referring to a 'template' when using the term 'page'. Blocks can contain dynamic content if written to do so or have a filling type that implies data.


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.


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

Posted 05 December 2017 - 02:06 AM #6

I know I can set 'disable_block_cache' => true but I'm wondering if there is a way to force the system to load a given page fresh (not from the cache) (to use when a promo URL is detected) and also have the system not cache a given page (when a promo ULR is used)

 

It seems that logged in used already use such functionality (promos that depend on a user group, for example, are only severed to the given user without any caching issues).

 

I would have that URL (SEO name) refer to a 'dispatch' request.  I.e. for the /cart page, it equates to dispatch=checkout.cart.

Then the controller can supply the appropriate data (like force the use of a coupon code to trigger a promotion, etc.).   

 

So as an example, a dispatch=my_changes.my-promotion would utilize the my_changes controller (addon) with a $mode of 'my-promotion'.  That controller can then decide whether to display a custom page (addons/my_changes/views/my_changes/my-promotion.tpl) or redirect to a different page.


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.


 
  • Brownleather
  • Junior Member
  • Members
  • Join Date: 06-Jan 10
  • 51 posts

Posted 05 December 2017 - 04:52 PM #7

Thanks for your reply,

 

We're looking to be able to add the "special value to the URL" for any existing page on the site (home, category, product details etc.) so that the url may look like www.domain.com/?special or www.domain.com/category/product-name.html?special etc., so I don't think a custom dispatch is not an option.

 

​The functionality we're looking for seems to exist when a user is logged in, in which case,

1. Fresh block content is loaded (not from the cache)

2. The fresh block content that is loaded for the logged in user is not cached (so that other visitors will not receive the logged in users block content).

 

Any ideas?



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

Posted 05 December 2017 - 06:53 PM #8

Okay, so you are adding a parameter to the URL (technically then a URI).
Then add a addons/my_changes/controllers/frontend/init.post.php with code something like:

<?php
 
if( !defined('BOOTSTRAP') ) die('Access denied');
 
if( isset($_REQUEST['special']) && @$_SERVER['REQUEST_METHOD'] == 'GET' && !defined('AJAX_REQUEST'])) {
  // Do your special processing here. 
}
return array(CONTROLLER_STATUS_OK);

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.