我們在EE 1.12中運行Advance Product Option Extension。在擴展程序之上,我們修改了它以使用cookie,因此如果客戶選擇了特定的自定義選項,則這些選項將保存在cookie中,並且當他再次訪問產品頁面時,這些選項將再次從Cookie中填充。Magento EE中的全頁緩存1.12
問題是Cookie值是在Magento FPCCache。我們通過傳球來嘗試使用打孔技術,但不幸的是,它不能很好地工作。
(1)除了打孔之外,還有其他方法可以解決這個問題嗎? (2)由於這是一個自定義模塊,我們是否要修改模塊/ etc/cache.xml或pagecache/cache.xml進行打孔。
問候,
史蒂夫
下面是我們對cookie中的部分代碼:
<?php
$pres_saved_data = Mage::helper('customoptions')->isCookieExist();
//$cookieModel = Mage::getModel('core/cookie');
//$pres_saved_data = $cookieModel->get('myprescription');
$show_prefilled_data = false;
$pres_data = array();
$other_pres_data = array();
if($pres_saved_data){
$sql = "select * from customer_prescription where id = '".$pres_saved_data."'";
$rowdata = $readConnection->fetchRow($sql);
if($rowdata){
$show_prefilled_data = true;
$optionsdata = unserialize($rowdata['prescription_options']);
$pres_data['options'] = unserialize($optionsdata['options']);
/* store all the option data which is there in cookie*/
$options_data = array(); $options_sku = array();
foreach($pres_data['options'] as $_data){
$label = strtolower(str_replace(" ",'_',$_data['label']));
if($label == 'prescription_type' || $label == 'lens' || $label =='pd' || $label == 'anti_reflective_coating') {
$options_data[] = $_data['value']; $options_sku[] = $_data['sku']; } else{
$other_pres_data[$label] = $_data['value'];
}
}
$sql = sprintf("SELECT v.option_type_id ,t.title,c.option_id,v.sku FROM catalog_product_option as c inner join
`catalog_product_option_type_value` as v
on c.option_id = v.option_id
inner join catalog_product_option_type_title as t on v.option_type_id = t.option_type_id
and v.sku in ('%s') and product_id = %s and t.title in ('%s') where store_id in(0,".Mage::app()->getStore()->getId().")",implode("', '",$options_sku),$current_product->getId(),implode("', '",$options_data));
$option_cookie_data = $readConnection->fetchAll($sql);
}
}
?>
<?php endif; ?>
我們的容器是:
我剛剛在問題中添加了容器代碼。請看看,並告訴我是否需要更正。我們期待完全繞過FPC。 – user1538621 2012-07-22 23:08:23
嘗試將此添加到您的容器類中: 'protected function _saveCache($ data,$ id,$ tags = array(),$ lifetime = null) { return false; }' 這應該防止它被緩存。 – Ryan 2012-07-23 02:27:05
它仍然是一樣的。我甚至嘗試過使用Javascript從cookie中獲取值以填充自定義選項,但整個事件由全頁面緩存進行緩存。 – user1538621 2012-07-23 17:50:35