php - Magento - Display product and category body page for each design in admin -
i need identify add cart button , disabled (js , php) based on product id(this not real aim of question, bold real one)
since haven't found solution have thought let admin press button in admin section dedicated tomy extension , capture button information js , save them later.
to display main body of product page , 1 of category each theme in design section.
how retrieve themes , packages:
//main package/theme mage::getstoreconfig('design/package/name') //reegex theme $ob=unserialize(mage::getstoreconfig('design/package/ua_regexp')); foreach($ob $key) echo $key['value'];
my main concern bold part, if possible? how do it?
clear: need red rectangle:
above there breadcrumbs , on right sidebar
more details
when admin creates/edit product, can select or not countries item can selled.
happens: when page load system check if item merchantable in costumers country otherwise removes button.
bring problems:
- wide theme support: i'm not sure button html same of default one
in same page can exist merchantable , not-merchantable products: identify button of correct item in category page there multiple of them, check button behaviour: contains:
/checkout/cart/
plusproduct id
inonlick
attribute or button submits form, think if admin "shows" me happens and, after analysis, able identify button , replace usingid
(secure) orclass
( not certain), since not stores use defaultbtn-cart
classcache/fpc system fetch page: don't know if catch js disable button or if customer has disbaled script (probably can't use site), usualy add cart block not cached programs (sometimes if item not available button hidden)
seo problem: guest aren't forced select country, try identify external service using ip, detect bots users, don't know if problem (i don't think so), otherwise have use js ajax call , hide button
i avoid edit template file , create simple way user set module( click button less complicated whole procedure create attribute, relatives options , associate sets)
basically: how can display product , category page in backend?
what using next logic removing button product page:
add new attribute (for example: hide_button, type yes/no) products in catalog > attributes > manage attributes. default 'no', products has button. admin can set attribute 'yes' needed products.
create observer catch
catalog_product_load_after
event:public function checkproduct(varien_event_observer $observer){ mage::register('hide_button', $observer->getevent()->getproduct()->getdata('hide_button')); return $this; }
create observer catch
controller_action_layout_generate_blocks_after
event , inject js code themes:public function injectscript(varien_event_observer $observer){ if (mage::registry('hide_button' == 1) { $head = $observer->getevent()->getlayout()->getblock('head'); $head->additem('js', 'hide-button.js'); } return $this; }
create file js/hide-button.js remove buttons class 'btn-cart' page:
event.observe(window, 'load', function() { $$("button.btn-cart").remove(); });
i didn't test code, it's idea.
Comments
Post a Comment