我知道Meteor支持事件,我已经在复选框上看到了它,但我只是希望有人能够澄清我们是否可以在选择下拉列表中连接meteor中的更改事件,如下所示
Template.templateName.events({
'change select': function(e,t){
// do whatever.......
}
});
Run Code Online (Sandbox Code Playgroud)
我试图使用Meteor这样做,当我更改选择框中的值时它似乎没有触发.但是,当我使用jQuery更改内容时,它可以正常工作.
我正在尝试开发一个涉及使用优惠券的Magento插件.显然,在环顾四周之后,我发现我找到了一个来源,提到使用'salesrule'表作为优惠券.但是,当我查看我的数据库时,我找不到它.但是我确实找到了3张提到"优惠券"的表格,名为"coupon_aggregated","coupon_aggregated_order"和"coupon_aggregated_updated".
我只是想知道3个表之间有什么区别所以我可以开始使用它们了吗?我正在使用最新版本的Magento.
提前谢谢你们.
我正处于部署的中间阶段,我试图通过使用Magento的观察者和事件给某些属性修复数据来覆盖产品,但问题是,我将这一切都用于我一直在开发的本地,但是当我上传到服务器并尝试通过观察者时似乎根本没有开火.我根据本教程编写了以下代码:http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method
我有两个文件,用于在/ app/code/local中实现此目的.
/app/code/local/Leafcutter/Catalog/etc/config.xml
<?xml version="1.0"?>
<config>
<global>
<models>
<leafcuttercatalog>
<class>Leafcutter_Catalog_Model</class>
</leafcuttercatalog>
</models>
<events>
<catalog_product_save_before>
<observers>
<leaf_cutter_catalog_productautoinsert_observer>
<type>singleton</type>
<class>Leafcutter_Catalog_Model_ProductAutoInsert_Observer</class>
<method>catalog_product_save_before</method>
</leaf_cutter_catalog_productautoinsert_observer>
</observers>
</catalog_product_save_before>
</events>
</global>
</config>
Run Code Online (Sandbox Code Playgroud)
/app/code/local/Leafcutter/Catalog/Model/ProductAutoInsert/Observer.php
class Leafcutter_Catalog_Model_ProductAutoInsert_Observer {
public function __construct(){}
/**
* catalog_product_save_before() is called before the product in the model is about to be saved. In this
* case, we want to override the saving mechanism and force the product to save certain preset data onto the product.
* @param $observer
* @return …Run Code Online (Sandbox Code Playgroud) 我正在meteor中编写应用程序并试图熟悉mongodb,我正在尝试使用以下架构更新用户.
user = {
... SOME DATA....,
"profile": {
"firstName": "HELLO",
"lastName": "MIKE",
"phoneNumber": "0432456524",
"userRole": "General Practitioner",
"practice": {
"name": "Hello koramaiku",
"address": "222 Hello St Helloville",
"state": "NSW",
"postcode": "2000"
},
"AHPRANumber": "4586546545",
"providerNumber": "4565498751321"
}, ..... SOME MORE DATA
}
Run Code Online (Sandbox Code Playgroud)
我有一个设置表单,它将修改用户的配置文件对象中的一些细节.我有一个表单,允许您编辑配置文件对象中的firstName,lastName和phoneNumber,而不替换一些现有的值.
var userData = {
firstName: 'Hello',
lastName: 'Kora',
phoneNumber: '0422222222'
};
Meteor.users.update({'_id': Meteor.userId() }, {$set : userData}, function(error){
........
});
Run Code Online (Sandbox Code Playgroud)
但是,如果我执行更新,它将使用新值覆盖整个配置文件对象,而不是仅替换我需要的值.据我所知,$ set修饰符将替换某个字段中的数据(如果它们已经存在),如果它们不存在则添加到set.
有没有办法像上面那样更新文档的数据,而不会覆盖我不想替换的数据?
谢谢.
magento ×2
meteor ×2
coupon ×1
events ×1
javascript ×1
jquery ×1
magento-1.7 ×1
mongodb ×1
observers ×1
php ×1