php - Magento product getFinalPrice for customer in custom script -
i have several catalog cost rules client groups. when viewing product logged-in client cost displays correctly. create inventory file can send client has discounted pricing. how do it?
what i've tried:
starting session client (with mage::getsingleton('customer/session')->loginbyid($customerid)
) before getting product collection, didn't seem impact $product->getfinalprice()
.
edit: should i've confirmed session working correctly echoing client grouping id session.
adding product sales/quote
created customer, getting cost off of quote_item
didn't work either.
i followed mage_catalog_model_product::getfinalprice()
, found 2 event observers, mage_catalogrule_model_observer::processfrontfinalprice()
, processadminfinalprice()
. looks should able set client grouping id on product i've tried doing ... no luck. logic determine client grouping id in processfrontfinalprice()
shown below:
if ($observer->hascustomergroupid()) { $gid = $observer->getevent()->getcustomergroupid(); } elseif ($product->hascustomergroupid()) { $gid = $product->getcustomergroupid(); } else { $gid = mage::getsingleton('customer/session')->getcustomergroupid(); }
did check method head? public function login($username, $password)
. can't utilize login() customerid.
but there is:
mage::getsingleton('customer/session')->loginbyid($customerid);
php magento
No comments:
Post a Comment