1. add compare html elem:
<!-- compare box --> <div class="compare-box"> <?php echo $this->__('compare')?> <a class="compare-a <?php echo $this->getCompareClass($_product->getId());?>" to_url="<?php echo $_compare_helper->getChangeAjaxUrl($_product);?>" is_compare="<?php if($this->is_compare($_product->getId())){ echo 1; } else { echo 0; }?>" ><?php echo $this->__('compare')?> <span class="icon"></span> </a> </div> <!-- compare box -->
2. get the compare status and class label info function in block class:
public function getCompareClass($productId) { $product = Mage::getModel('catalog/product')->load($productId); $item = Mage::getModel('catalog/product_compare_item'); $list = Mage::getModel('catalog/product_compare_list'); //$list->_addVisitorToItem($item); $item->addVisitorId(Mage::getSingleton('log/visitor')->getId()); if (Mage::getSingleton('customer/session')->isLoggedIn()) { $item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer()); } $item->loadByProduct($product); if ($item->getId()) { return 'compared'; } else { return 'uncompared'; } } public function getCompareLabel($productId) { $product = Mage::getModel('catalog/product')->load($productId); $item = Mage::getModel('catalog/product_compare_item'); $list = Mage::getModel('catalog/product_compare_list'); //$list->_addVisitorToItem($item); $item->addVisitorId(Mage::getSingleton('log/visitor')->getId()); if (Mage::getSingleton('customer/session')->isLoggedIn()) { $item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer()); } $item->loadByProduct($product); if ($item->getId()) { return 'Compared'; } else { return 'Uncompared'; } } /** * check the product is compare or not * @param unknown $productId */ public function is_compare($productId) { $product = Mage::getModel('catalog/product')->load($productId); $item = Mage::getModel('catalog/product_compare_item'); $list = Mage::getModel('catalog/product_compare_list'); //$list->_addVisitorToItem($item); $item->addVisitorId(Mage::getSingleton('log/visitor')->getId()); if (Mage::getSingleton('customer/session')->isLoggedIn()) { $item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer()); } $item->loadByProduct($product); if ($item->getId()) { return true; } else { return false; } }
3. rewrite core helper file to set new custom compare function url:
the php:
<?php class Bysoft_Mycatalog_Helper_Product_Compare extends Mage_Catalog_Helper_Product_Compare { // some code public function getAddajaxUrl($product) { return $this->_getUrl('catalog/product_compare/addajax', $this->_getAjaxUrlParams($product)); } protected function _getAjaxUrlParams($product) { return array( 'product' => $product->getId() ); } public function getChangeAjaxUrl($product) { return $this->_getUrl('catalog/product_compare/changeajax', $this->_getAjaxUrlParams($product)); } public function getAddCompareUrl($product) { return $this->_getUrl('catalog/product_compare/addtocompareajax', $this->_getAjaxUrlParams($product)); } /** * Retrieve remove item from compare list url * * @param $item * @return string */ public function getRemoveajaxUrl($item) { $params = array( 'product' => $item->getId(), ); return $this->_getUrl('catalog/product_compare/removeajax', $params); } }
the xml:
<config> <modules> <Bysoft_Mycatalog> <version>0.1.0</version> </Bysoft_Mycatalog> </modules> <global> <helpers> <mycatalog> <class>Bysoft_Mycatalog_Helper</class> <resourceModel>mycatalog_mysql4</resourceModel> </mycatalog> <catalog> <rewrite> <product_compare>Bysoft_Mycatalog_Helper_Product_Compare</product_compare> </rewrite> </catalog> </helpers>
4. custom function for deal with ajax compare action:
the php:
require_once(Mage::getModuleDir('controllers','Mage_Catalog').DS.'Product'.DS.'CompareController.php'); class Bysoft_Mycatalog_Product_CompareController extends Mage_Catalog_Product_CompareController { protected $_items; protected $_max_pc; protected $_max_mobile; //clecn all products in compare list public function cleanajaxAction() { $items = Mage::getResourceModel('catalog/product_compare_item_collection'); if (Mage::getSingleton('customer/session')->isLoggedIn()) { $items->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId()); } elseif ($this->_customerId) { $items->setCustomerId($this->_customerId); } else { $items->setVisitorId(Mage::getSingleton('log/visitor')->getId()); } /** @var $session Mage_Catalog_Model_Session */ $session = Mage::getSingleton('catalog/session'); try { $items->clear(); Mage::helper('catalog/product_compare')->calculate(); echo json_encode(array('status'=>'1','msg'=>'clean compare products successed!')); return; } catch (Exception $e){ //do nothing echo json_encode(array('status'=>'2','msg'=>$this->__($e->getMessage()))); return; } } //add product to compare from detail page public function addtocompareajaxAction() { $productId = (int) $this->getRequest()->getParam('product'); } public function changeajaxAction() { $productId = (int) $this->getRequest()->getParam('product'); if ($productId && (Mage::getSingleton('log/visitor')->getId() || Mage::getSingleton('customer/session')->isLoggedIn()) ) { if ($this->is_compare($productId)) { // to uncompared $this->remove_compare($productId); } else { // to compared $this->add_compare($productId); } } } /** * check the product is compare or not * @param unknown $productId */ public function is_compare($productId) { $product = Mage::getModel('catalog/product')->load($productId); $item = Mage::getModel('catalog/product_compare_item'); $list = Mage::getModel('catalog/product_compare_list'); //$list->_addVisitorToItem($item); $item->addVisitorId(Mage::getSingleton('log/visitor')->getId()); if (Mage::getSingleton('customer/session')->isLoggedIn()) { $item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer()); } $item->loadByProduct($product); if ($item->getId()) { return true; } else { return false; } } public function mobileAction() { $items = $this->getRequest()->getParam('items'); if ($beforeUrl = $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED)) { Mage::getSingleton('catalog/session') ->setBeforeCompareUrl(Mage::helper('core')->urlDecode($beforeUrl)); } if ($items) { $items = explode(',', $items); $list = Mage::getSingleton('catalog/product_compare_list'); $list->addProducts($items); $this->_redirect('*/*/*'); return; } $this->loadLayout(); $this->renderLayout(); } public function exists_other_attribute_set_product($productId) { //get product attribute set name $product = Mage::getModel('catalog/product')->load($productId); $attributeSetId = $product->getAttributeSetId(); $exists_flag = false; //get item colletion $collection = $this->getItems(); foreach ($collection as $_product) { $attributeSetCompareId = $_product->getData('attribute_set_id'); if ($attributeSetCompareId != $attributeSetId) { $exists_flag = true; break; } } return $exists_flag; } public function reach_max() { $this->_max_pc = 4; $this->_max_mobile = 2; if ($this->is_mobile()) { $max = $this->_max_mobile; } else { $max = $this->_max_pc; } $_items = $this->getItems(); if ($_items->getSize() == $max) { return true; } else { return false; } } public function getItems() { Mage::helper('catalog/product_compare')->setAllowUsedFlat(false); $this->_items = Mage::getResourceModel('catalog/product_compare_item_collection') ->useProductItem(true) ->setStoreId(Mage::app()->getStore()->getId()); if (Mage::getSingleton('customer/session')->isLoggedIn()) { $this->_items->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId()); } elseif ($this->_customerId) { $this->_items->setCustomerId($this->_customerId); } else { $this->_items->setVisitorId(Mage::getSingleton('log/visitor')->getId()); } $this->_items ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes()) ->loadComparableAttributes() ->addMinimalPrice() ->addTaxPercents(); Mage::getSingleton('catalog/product_visibility') ->addVisibleInSiteFilterToCollection($this->_items); return $this->_items; } public function add_compare($productId) { $max = ''; try { if ($productId && (Mage::getSingleton('log/visitor')->getId() || Mage::getSingleton('customer/session')->isLoggedIn()) ) { if (!$this->exists_other_attribute_set_product($productId)) { // check exists other set products if (!$this->reach_max()) {//check max compare number $product = Mage::getModel('catalog/product') ->setStoreId(Mage::app()->getStore()->getId()) ->load($productId); if ($product->getId()/* && !$product->isSuper()*/) { Mage::getSingleton('catalog/product_compare_list')->addProduct($product); /* Mage::getSingleton('catalog/session')->addSuccess( $this->__('The product %s has been added to comparison list.', Mage::helper('core')->escapeHtml($product->getName())) ); */ Mage::dispatchEvent('catalog_product_compare_add_product', array('product'=>$product)); } Mage::helper('catalog/product_compare')->calculate(); } else { if ($this->is_mobile()) { $max = $this->_max_mobile; } else { $max = $this->_max_pc; } echo json_encode(array('status'=>'2','msg'=>$this->__("You can compare only {$max} items at the same time."))); return; } } else { echo json_encode(array('status'=>'2','msg'=>$this->__('Please add same type product into compare list.'))); return; } } echo json_encode(array('status'=>'1','is_compare'=>'1', 'compare_count'=>Mage::helper('catalog/product_compare')->getItemCollection()->getSize())); return; } catch (Exception $e) { echo json_encode(array('status'=>'2','msg'=>$e->getMessage())); return; } } public function remove_compare($productId) { try { if ((int) $productId) { $product = Mage::getModel('catalog/product') ->setStoreId(Mage::app()->getStore()->getId()) ->load($productId); if($product->getId()) { /** @var $item Mage_Catalog_Model_Product_Compare_Item */ $item = Mage::getModel('catalog/product_compare_item'); if(Mage::getSingleton('customer/session')->isLoggedIn()) { $item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer()); } elseif ($this->_customerId) { $item->addCustomerData( Mage::getModel('customer/customer')->load($this->_customerId) ); } else { $item->addVisitorId(Mage::getSingleton('log/visitor')->getId()); } $item->loadByProduct($product); if($item->getId()) { $item->delete(); /* Mage::getSingleton('catalog/session')->addSuccess( $this->__('The product %s has been removed from comparison list.', $product->getName()) ); */ Mage::dispatchEvent('catalog_product_compare_remove_product', array('product'=>$item)); Mage::helper('catalog/product_compare')->calculate(); } } } echo json_encode(array('status'=>'1','is_compare'=>0,'compare_count'=>Mage::helper('catalog/product_compare')->getItemCollection()->getSize())); return; } catch (Exception $e) { echo json_encode(array('status'=>'2','msg'=>$e->getMessage())); return; } } public static function is_mobile(){ $user_agent = $_SERVER['HTTP_USER_AGENT']; // get the user agent value - this should be cleaned to ensure no nefarious input gets executed $accept = $_SERVER['HTTP_ACCEPT']; // get the content accept value - this should be cleaned to ensure no nefarious input gets executed return false || (preg_match('/ipad/i',$user_agent)) || (preg_match('/ipod/i',$user_agent)||preg_match('/iphone/i',$user_agent)) || (preg_match('/android/i',$user_agent)) || (preg_match('/opera mini/i',$user_agent)) || (preg_match('/blackberry/i',$user_agent)) || (preg_match('/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i',$user_agent)) || (preg_match('/(iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent)) || (preg_match('/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo)/i',$user_agent)) || ((strpos($accept,'text/vnd.wap.wml')>0)||(strpos($accept,'application/vnd.wap.xhtml+xml')>0)) || (isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])) || (in_array(strtolower(substr($user_agent,0,4)),array('1207'=>'1207','3gso'=>'3gso','4thp'=>'4thp','501i'=>'501i','502i'=>'502i','503i'=>'503i','504i'=>'504i','505i'=>'505i','506i'=>'506i','6310'=>'6310','6590'=>'6590','770s'=>'770s','802s'=>'802s','a wa'=>'a wa','acer'=>'acer','acs-'=>'acs-','airn'=>'airn','alav'=>'alav','asus'=>'asus','attw'=>'attw','au-m'=>'au-m','aur '=>'aur ','aus '=>'aus ','abac'=>'abac','acoo'=>'acoo','aiko'=>'aiko','alco'=>'alco','alca'=>'alca','amoi'=>'amoi','anex'=>'anex','anny'=>'anny','anyw'=>'anyw','aptu'=>'aptu','arch'=>'arch','argo'=>'argo','bell'=>'bell','bird'=>'bird','bw-n'=>'bw-n','bw-u'=>'bw-u','beck'=>'beck','benq'=>'benq','bilb'=>'bilb','blac'=>'blac','c55/'=>'c55/','cdm-'=>'cdm-','chtm'=>'chtm','capi'=>'capi','cond'=>'cond','craw'=>'craw','dall'=>'dall','dbte'=>'dbte','dc-s'=>'dc-s','dica'=>'dica','ds-d'=>'ds-d','ds12'=>'ds12','dait'=>'dait','devi'=>'devi','dmob'=>'dmob','doco'=>'doco','dopo'=>'dopo','el49'=>'el49','erk0'=>'erk0','esl8'=>'esl8','ez40'=>'ez40','ez60'=>'ez60','ez70'=>'ez70','ezos'=>'ezos','ezze'=>'ezze','elai'=>'elai','emul'=>'emul','eric'=>'eric','ezwa'=>'ezwa','fake'=>'fake','fly-'=>'fly-','fly_'=>'fly_','g-mo'=>'g-mo','g1 u'=>'g1 u','g560'=>'g560','gf-5'=>'gf-5','grun'=>'grun','gene'=>'gene','go.w'=>'go.w','good'=>'good','grad'=>'grad','hcit'=>'hcit','hd-m'=>'hd-m','hd-p'=>'hd-p','hd-t'=>'hd-t','hei-'=>'hei-','hp i'=>'hp i','hpip'=>'hpip','hs-c'=>'hs-c','htc '=>'htc ','htc-'=>'htc-','htca'=>'htca','htcg'=>'htcg','htcp'=>'htcp','htcs'=>'htcs','htct'=>'htct','htc_'=>'htc_','haie'=>'haie','hita'=>'hita','huaw'=>'huaw','hutc'=>'hutc','i-20'=>'i-20','i-go'=>'i-go','i-ma'=>'i-ma','i230'=>'i230','iac'=>'iac','iac-'=>'iac-','iac/'=>'iac/','ig01'=>'ig01','im1k'=>'im1k','inno'=>'inno','iris'=>'iris','jata'=>'jata','java'=>'java','kddi'=>'kddi','kgt'=>'kgt','kgt/'=>'kgt/','kpt '=>'kpt ','kwc-'=>'kwc-','klon'=>'klon','lexi'=>'lexi','lg g'=>'lg g','lg-a'=>'lg-a','lg-b'=>'lg-b','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-f'=>'lg-f','lg-g'=>'lg-g','lg-k'=>'lg-k','lg-l'=>'lg-l','lg-m'=>'lg-m','lg-o'=>'lg-o','lg-p'=>'lg-p','lg-s'=>'lg-s','lg-t'=>'lg-t','lg-u'=>'lg-u','lg-w'=>'lg-w','lg/k'=>'lg/k','lg/l'=>'lg/l','lg/u'=>'lg/u','lg50'=>'lg50','lg54'=>'lg54','lge-'=>'lge-','lge/'=>'lge/','lynx'=>'lynx','leno'=>'leno','m1-w'=>'m1-w','m3ga'=>'m3ga','m50/'=>'m50/','maui'=>'maui','mc01'=>'mc01','mc21'=>'mc21','mcca'=>'mcca','medi'=>'medi','meri'=>'meri','mio8'=>'mio8','mioa'=>'mioa','mo01'=>'mo01','mo02'=>'mo02','mode'=>'mode','modo'=>'modo','mot '=>'mot ','mot-'=>'mot-','mt50'=>'mt50','mtp1'=>'mtp1','mtv '=>'mtv ','mate'=>'mate','maxo'=>'maxo','merc'=>'merc','mits'=>'mits','mobi'=>'mobi','motv'=>'motv','mozz'=>'mozz','n100'=>'n100','n101'=>'n101','n102'=>'n102','n202'=>'n202','n203'=>'n203','n300'=>'n300','n302'=>'n302','n500'=>'n500','n502'=>'n502','n505'=>'n505','n700'=>'n700','n701'=>'n701','n710'=>'n710','nec-'=>'nec-','nem-'=>'nem-','newg'=>'newg','neon'=>'neon','netf'=>'netf','noki'=>'noki','nzph'=>'nzph','o2 x'=>'o2 x','o2-x'=>'o2-x','opwv'=>'opwv','owg1'=>'owg1','opti'=>'opti','oran'=>'oran','p800'=>'p800','pand'=>'pand','pg-1'=>'pg-1','pg-2'=>'pg-2','pg-3'=>'pg-3','pg-6'=>'pg-6','pg-8'=>'pg-8','pg-c'=>'pg-c','pg13'=>'pg13','phil'=>'phil','pn-2'=>'pn-2','pt-g'=>'pt-g','palm'=>'palm','pana'=>'pana','pire'=>'pire','pock'=>'pock','pose'=>'pose','psio'=>'psio','qa-a'=>'qa-a','qc-2'=>'qc-2','qc-3'=>'qc-3','qc-5'=>'qc-5','qc-7'=>'qc-7','qc07'=>'qc07','qc12'=>'qc12','qc21'=>'qc21','qc32'=>'qc32','qc60'=>'qc60','qci-'=>'qci-','qwap'=>'qwap','qtek'=>'qtek','r380'=>'r380','r600'=>'r600','raks'=>'raks','rim9'=>'rim9','rove'=>'rove','s55/'=>'s55/','sage'=>'sage','sams'=>'sams','sc01'=>'sc01','sch-'=>'sch-','scp-'=>'scp-','sdk/'=>'sdk/','se47'=>'se47','sec-'=>'sec-','sec0'=>'sec0','sec1'=>'sec1','semc'=>'semc','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','sk-0'=>'sk-0','sl45'=>'sl45','slid'=>'slid','smb3'=>'smb3','smt5'=>'smt5','sp01'=>'sp01','sph-'=>'sph-','spv '=>'spv ','spv-'=>'spv-','sy01'=>'sy01','samm'=>'samm','sany'=>'sany','sava'=>'sava','scoo'=>'scoo','send'=>'send','siem'=>'siem','smar'=>'smar','smit'=>'smit','soft'=>'soft','sony'=>'sony','t-mo'=>'t-mo','t218'=>'t218','t250'=>'t250','t600'=>'t600','t610'=>'t610','t618'=>'t618','tcl-'=>'tcl-','tdg-'=>'tdg-','telm'=>'telm','tim-'=>'tim-','ts70'=>'ts70','tsm-'=>'tsm-','tsm3'=>'tsm3','tsm5'=>'tsm5','tx-9'=>'tx-9','tagt'=>'tagt','talk'=>'talk','teli'=>'teli','topl'=>'topl','hiba'=>'hiba','up.b'=>'up.b','upg1'=>'upg1','utst'=>'utst','v400'=>'v400','v750'=>'v750','veri'=>'veri','vk-v'=>'vk-v','vk40'=>'vk40','vk50'=>'vk50','vk52'=>'vk52','vk53'=>'vk53','vm40'=>'vm40','vx98'=>'vx98','virg'=>'virg','vite'=>'vite','voda'=>'voda','vulc'=>'vulc','w3c '=>'w3c ','w3c-'=>'w3c-','wapj'=>'wapj','wapp'=>'wapp','wapu'=>'wapu','wapm'=>'wapm','wig '=>'wig ','wapi'=>'wapi','wapr'=>'wapr','wapv'=>'wapv','wapy'=>'wapy','wapa'=>'wapa','waps'=>'waps','wapt'=>'wapt','winc'=>'winc','winw'=>'winw','wonu'=>'wonu','x700'=>'x700','xda2'=>'xda2','xdag'=>'xdag','yas-'=>'yas-','your'=>'your','zte-'=>'zte-','zeto'=>'zeto','acs-'=>'acs-','alav'=>'alav','alca'=>'alca','amoi'=>'amoi','aste'=>'aste','audi'=>'audi','avan'=>'avan','benq'=>'benq','bird'=>'bird','blac'=>'blac','blaz'=>'blaz','brew'=>'brew','brvw'=>'brvw','bumb'=>'bumb','ccwa'=>'ccwa','cell'=>'cell','cldc'=>'cldc','cmd-'=>'cmd-','dang'=>'dang','doco'=>'doco','eml2'=>'eml2','eric'=>'eric','fetc'=>'fetc','hipt'=>'hipt','http'=>'http','ibro'=>'ibro','idea'=>'idea','ikom'=>'ikom','inno'=>'inno','ipaq'=>'ipaq','jbro'=>'jbro','jemu'=>'jemu','java'=>'java','jigs'=>'jigs','kddi'=>'kddi','keji'=>'keji','kyoc'=>'kyoc','kyok'=>'kyok','leno'=>'leno','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-g'=>'lg-g','lge-'=>'lge-','libw'=>'libw','m-cr'=>'m-cr','maui'=>'maui','maxo'=>'maxo','midp'=>'midp','mits'=>'mits','mmef'=>'mmef','mobi'=>'mobi','mot-'=>'mot-','moto'=>'moto','mwbp'=>'mwbp','mywa'=>'mywa','nec-'=>'nec-','newt'=>'newt','nok6'=>'nok6','noki'=>'noki','o2im'=>'o2im','opwv'=>'opwv','palm'=>'palm','pana'=>'pana','pant'=>'pant','pdxg'=>'pdxg','phil'=>'phil','play'=>'play','pluc'=>'pluc','port'=>'port','prox'=>'prox','qtek'=>'qtek','qwap'=>'qwap','rozo'=>'rozo','sage'=>'sage','sama'=>'sama','sams'=>'sams','sany'=>'sany','sch-'=>'sch-','sec-'=>'sec-','send'=>'send','seri'=>'seri','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','siem'=>'siem','smal'=>'smal','smar'=>'smar','sony'=>'sony','sph-'=>'sph-','symb'=>'symb','t-mo'=>'t-mo','teli'=>'teli','tim-'=>'tim-','tosh'=>'tosh','treo'=>'treo','tsm-'=>'tsm-','upg1'=>'upg1','upsi'=>'upsi','vk-v'=>'vk-v','voda'=>'voda','vx52'=>'vx52','vx53'=>'vx53','vx60'=>'vx60','vx61'=>'vx61','vx70'=>'vx70','vx80'=>'vx80','vx81'=>'vx81','vx83'=>'vx83','vx85'=>'vx85','wap-'=>'wap-','wapa'=>'wapa','wapi'=>'wapi','wapp'=>'wapp','wapr'=>'wapr','webc'=>'webc','whit'=>'whit','winw'=>'winw','wmlb'=>'wmlb','xda-'=>'xda-',))) ; } } ?>
the xml:
<config> <frontend> <routers> <catalog> <args> <modules> <bysoft_mycatalog before="Mage_Catalog">Bysoft_Mycatalog</bysoft_mycatalog> </modules> </args> </catalog> <mycatalog> <use>standard</use> <args> <module>Bysoft_Mycatalog</module> <frontName>mycatalog</frontName> </args> </mycatalog> </routers> <layout> <updates> <mycatalog> <file>mycatalog.xml</file> </mycatalog> </updates> </layout> </frontend>
相关推荐
Ajax-magento2-ajax-cart-quick.zip,magento 2 ajax购物车扩展插件提供舒适的购物体验。客户可以很容易地选择可配置的选项并在弹出窗口中编辑项目,而不会浪费重新加载页面的时间。,ajax代表异步javascript和xml。它...
Ajax-magento2-ajax-layered-navigation.zip,ajax分层导航magento 2提供了一个过滤器列表,帮助您的客户以最短的方式搜索和获得他们最喜欢的产品。这个扩展应用了现代ajax技术来增强过滤系统,以提高用户对页面上每...
Ajax-magento2-ajax-cart.zip,ajax add to cart for extension magento 2提供了通过ajax弹出窗口将产品添加到购物车的主要功能。它通过允许客户从产品列表页面将任何产品类型添加到购物车,显著改善了用户体验。,...
"Magento Ajax购物车"是指利用Ajax技术实现的无刷新购物车更新,使得用户在添加、修改或删除商品时无需跳转页面,提供更加流畅的购物体验。 一、Magento购物车的基本原理 购物车是电商网站的核心部分,Magento的...
Magento AJAX 搜索是一种在 Magento 商城中实现的高级搜索功能,它通过利用 AJAX(异步JavaScript和XML)技术,提供用户友好的实时搜索体验。在传统的搜索方式中,用户输入查询后,页面需要完全刷新才能显示结果。而...
Ajax-magento2-module-ajax.zip,用于ajax请求的magento 2模块,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它用于创建动态网页,其中网页的小部分在不重新加载网页...
Ajax-magento2-catalog-infinite-scroll.zip,免费的Magento 2扩展,为目录添加无限滚动功能(通过AJAX实现)编码教程,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。...
Ajax-Magento-ajax-add-to-cart.zip,[模块magento 1]magento ajax添加到购物车-ajoter vos produits au panier en ajax/感谢ajax将您的产品添加到购物车,ajax代表异步javascript和xml。它是多种web技术的集合,包括...
在这个"magento新版ajax购物车插件"中,我们主要关注的是如何利用Ajax技术改进Magento购物车的用户体验。 首先,Ajax(Asynchronous JavaScript and XML)是一种在不重新加载整个网页的情况下更新部分网页的技术。...
Magetop的Magento 2 Ajax购物车扩展Magetop开发的Magento 2 Ajax购物车扩展程序具有通过AJAX弹出窗口向购物车添加产品的主要功能。 通过允许客户直接从产品列表页面将任何产品类型添加到购物车,它可以显着改善用户...
Magento 快速查看 Ajax 加载程序 “Quick View Ajax Loader”是 Magento 在线商店中产品列表页面的扩展。 让您的客户无需离开类别页面即可查看您商店中产品的详细信息。 兼容 Magento 1.4、1.4.1.1、1.5、1.6、1.7...
Magento 2 AJAX 分层导航是一种增强用户购物体验的扩展,尤其在电子商务网站中,它能够大大提高客户的浏览效率和购买转化率。此扩展的核心是利用AJAX(异步JavaScript和XML)技术来实现实时过滤,使得用户在不刷新...
前端通过AJAX请求向服务器发送请求,获取购物车数据;后端则处理请求,返回购物车信息,前端再根据这些信息更新购物车界面。整个过程中,涉及到的数据主要包括商品ID、数量、价格、图片等,这些数据在数据库中被存储...
Magento是一款强大的开源电子商务平台,它提供了丰富的功能和高度的可定制性。在Magento中创建自定义页面是一项常见的任务,这通常涉及到对系统架构的理解、模板文件的编辑以及URL的配置。在这个实例中,我们将深入...
在电商领域,经常会有需求将一个已经建立并运行良好的Magento站点快速复制到另一个服务器,用于测试、备份或者创建一个新的独立站点。这个过程涉及到数据库的备份与还原、文件系统的复制以及配置的调整等多个步骤。 ...
演示地址:http://olegnax.com/product/athlete-responsive-magento-theme/livepreview/ Athlete Magento主题,兼容...黑白2个版本,AJAX加入购物车,快速查看,高级幻灯片,博客,提供快速安装包演示数据和说明文档。
#1 Magento 2 Ajax分层导航免费 产品过滤是每个客户都渴望在您的在线商店中使用的最常用功能之一。 为了明确起见,产品过滤是一种应用程序,买方可以选择一个或多个产品属性来搜索符合其需求的特定产品。 在没有...
标题:“Magento数据结构分析” 描述:“Magento数据字典”提供了对Magento系统中各种数据库表的深入理解,这对于理解和优化Magento的性能至关重要。 一、Magento数据结构解析 Magento是一款功能强大的电子商务...
Magento是一款强大的开源电子商务平台,以其高度可定制性和灵活性著称。在进行Magento的二次开发时,你需要理解并掌握以下几个核心概念和技术: 1. **MVC架构**:Magento基于Model-View-Controller(MVC)设计模式...