[TYPO3-commerce] $GLOBALS['TSFE']->set_no_cache() --> bad practice --> why using it?

Ingo Schmitt mailinglisten at i-schmitt.de
Wed Aug 29 18:46:14 CEST 2007


Hi Franz,

we had a long discussion about the caching of pi2 (basket) and pi3 
(checkout) in the project list.

We considered:
If someone is in the Checkout-Process we need to be absolutly shure, 
that no cachinging is done, since we need to be shure that payment 
informations have to be personell for only one user. Se we are using a 
non cachable link to the checkout from the basket (which basically means 
that no chash is generated).
Therefore I only changed in SVN the 0 to false in the call for the 
checkout.

The link to the basket could be cached, since normally the change of the 
basket is also represented by a new basket_hash to the GET parameter. I 
have changed it in SVN to be cacheable, and tested in in a few 
installations, but I'm not shure about it.







> Again me,
> 
> in the basket quickView the two links to the full basket and to the 
> checkout are not allowed to be cached and therefore use the 'no_cache' 
> option. This is a) bad practice and b) not necessary, as the checkout 
> and the basket plugins are of type USER_INT and therefore normally not 
> cached - right? So let's gain some performance back and don't apply the 
> no_cache parameter to the links:
> 
> --- change lines 322 and 323 from class.tx_commerce_pi2.php -----------
> from:
> $basketArray['###URL###'] = 
> $this->pi_linkTP_keepPIvars_url(array(),0,1,$this->conf['basketPid']);
>         $basketArray['###URL_CHECKOUT###'] = 
> $this->pi_linkTP_keepPIvars_url(array(),0,1,$this->conf['checkoutPid']);
> 
> to:
> $basketArray['###URL###'] = 
> $this->pi_linkTP_keepPIvars_url(array(),1,1,$this->conf['basketPid']);
>         $basketArray['###URL_CHECKOUT###'] = 
> $this->pi_linkTP_keepPIvars_url(array(),1,1,$this->conf['checkoutPid']);
> -----------------
> 
> When modifying the class anyway, you could add the missing definition 
> for the marker '###BASKET_ITEMS###' which is set in the main basket but 
> not in the quickView. The marker doesn't provide the article list but 
> the item count of the basket:
> 
> -----
> $basketArray['###BASKET_ITEMS###'] = $this->basket->getItemsCount();
> -----
> 

I've added
$basketArray['###BASKET_ITEMS###'] = count($list);
###ITEMS### is depricated now.

If you use $this->basket->getItemsCount(), you'll get all items, 
including delivery and payment. If you opnly want "normal" articles, you 
need to call:


$this->basket->getArticleTypeCount($this->conf['regularArticleTypes']);

Is in SVN right now (REV 6370)

Regards

Ingo
> Should I put that to bugtracker, or is it ok here as it is done within 
> 15 seconds ;)
> 
> Btw. the function getItemsCount seems to be wrong - I currently only 
> have 1 item in the stock, but it counts 3 items (I guess delivery and 
> payment).
> 
> -- 
> Kind regards,
> Franz Koch


Mit freundlichen Gruessen
-- 
Ingo Schmitt                        mailto:is at marketing-factory.de
Marketing Factory Consulting GmbH   http://typo3.marketing-factory.de/
Content Management mit Typo3: Beratung - Schulung - Realisierung


More information about the TYPO3-project-commerce mailing list