Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento多存储电子邮件模板_Magento - Fatal编程技术网

Magento多存储电子邮件模板

Magento多存储电子邮件模板,magento,Magento,我有一个带有共享电子邮件模板的多商店设置(商店a和B)。在这些模板中,我引用了在A和B上区分的自定义变量 Shop A ==\ /==> Custom Var (version A) >==> E-mail Template X ==< Shop B ==/ \==> Custom Var (version B) Shop A==\/=>自

我有一个带有共享电子邮件模板的多商店设置(商店a和B)。在这些模板中,我引用了在A和B上区分的自定义变量

Shop A ==\                           /==> Custom Var (version A)
          >==>  E-mail Template X ==<
Shop B ==/                           \==> Custom Var (version B)
Shop A==\/=>自定义变量(版本A)
>==>电子邮件模板X==<
车间B==/\==>自定义变量(版本B)
这工作得很好,除了一个问题:当我通过商店B的管理员创建一个帐户时,我无法得到商店B的密码提醒。向这个用户发送一个新密码将始终作为商店a发送

请注意,发送的欢迎邮件是正确的(B),但我猜这只是因为您从“创建帐户”屏幕中选择了发送商店

我确实意识到,该帐户被标记为由管理员而不是商店B创建,而不是通过商店B注册。我可以想象这可能会导致问题,但我还是想找到一种方法:

  • 通过管理员为商店B创建一个帐户
  • 在商店B-style中发送密码提醒


  • 编辑:以下问题在某种意义上是有关将用户与管理员提供的商店关联的:

    默认情况下,似乎无法从管理员创建链接到特定商店的帐户。不过,我确实找到了一种方法,通过聆听adminhtml\u customer\u prepare\u save和滥用帐户创建表单中的“发送自”

    这是我为它准备的一个模块:

    etc\config.xml:

    <config>
      <modules>
        <Company_AccountPerStore>
          <version>1.0</version>
        </Company_AccountPerStore>
      </modules>
      <global>
        <models>
          <accountperstore>
            <class>Company_AccountPerStore_Model</class>
          </accountperstore>
        </models>
      </global>
      <adminhtml>
        <events>
          <adminhtml_customer_prepare_save>
            <observers>
              <accountperstore_observer>
                <class>Company_AccountPerStore_Model_Observer</class>
                <method>customerPrepareSave</method>
              </accountperstore_observer>
            </observers>
          </adminhtml_customer_prepare_save>
        </events>
      </adminhtml>
    </config>
    
    请注意,您将无法再检测到该帐户是由管理员创建的

    class Company_AccountPerStore_Model_Observer extends Varien_Object
    {
      public function customerPrepareSave($observer)
      {
        $customer = $observer->getEvent()->getCustomer();
    
        if (!$customer->hasStoreId() && $customer->hasData('sendemail_store_id')) {
          $customer->setStoreId($customer->getData('sendemail_store_id'));
        }
      }
    }