小编Mag*_*cho的帖子

如何在顶级链接中添加课程?

我尝试使用以下方法将类添加到顶部链接<aParams>class="class-name"</aParams>
:

<reference name="top.links">
    <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><aParams>class="top-link-myaccount"</aParams><position>10</position></action>
</reference>
Run Code Online (Sandbox Code Playgroud)

上面的技巧对我来说至少对于1.7.0.0版本没有用.
任何的想法?

编辑:
我想我用它修复了它<li/><a>class="top-links-register"</a>:

<reference name="top.links">
        <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><aParams/><position>10</position><li/><a>class="top-link-myaccount"</a></action>
    </reference>
Run Code Online (Sandbox Code Playgroud)

请注意,您必须前置 <li/>

magento

5
推荐指数
2
解决办法
1万
查看次数

Magento - 如何使用customer_save_after事件更新送货地址?

我试图customer_save_after在客户尝试创建新帐户或编辑其帐户时使用事件(基于某些自定义注册字段)为客户创建或更新默认送货地址.

这是Observer模型代码的一部分:

...
$customer   = $observer->getEvent()->getCustomer();
if ($customer->getId() && $otherConditionIsValid){
    $dataShipping = array(
        'firstname' => $someFixedFirstName,
        'lastname'  => $someFixedLastName,
        'street'    => array($someFixedStreetLine),
        'city'      => $someFixedCity,
        'region'    => $someFixedState,
        'region_id' => '',
        'postcode'  => $someFixedZipcode,
        'country_id' => $someFixedCountry,
        'telephone' => $someFixedTelephone,
    );
    $customerAddress = Mage::getModel('customer/address');
    if($defaultShippingId = $customer->getDefaultShipping()){ //if customer already has default shipping address
        $customerAddress->load($defaultShippingId);
    }
    $customerAddress->setData($dataShipping)
                    ->setCustomerId($customer->getId())
                    ->setIsDefaultShipping('1')
                    ->setSaveInAddressBook('1');
    $customer->addAddress($customerAddress); #setting Shipping Address to be added/updated
    //When i try to use below commented code, script gets called …
Run Code Online (Sandbox Code Playgroud)

php magento

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

magento ×2

php ×1