我是magento的新人.我需要在Magento中创建自己的模块(或)扩展.在我的模块中,无法在magento表中创建表.我正在使用此代码.
File:/app/code/local/com_name/module_name/sql/module_setup/mysql4_install-0.1.0.php
$installer = $this;
$installer->startSetup();
$installer->run("
DROP TABLE IF EXISTS {$this->getTable('th_tweet')};
CREATE TABLE {$this->getTable('th_tweet')} (
`tweet_id` int(11) NOT NULL AUTO_INCREMENT,
`updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`twitter_id` bigint(20) NOT NULL,
`text` text NOT NULL,
PRIMARY KEY (`tweet_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
");
$installer->endSetup();
Run Code Online (Sandbox Code Playgroud)
然后,可以像这样调用config.xml文件,
<models>
<tweet>
<class>TechAndHouse_Tweet_Model</class>
<resourceModel>tweet_mysql4</resourceModel>
</tweet>
<tweet_mysql4>
<class>TechAndHouse_Tweet_Model_Mysql4</class>
<entities>
<tweet>
<table>th_tweet</table>
</tweet>
</entities>
</tweet_mysql4>
</models>
Run Code Online (Sandbox Code Playgroud)
我在管理面板中创建选项卡,前端块已创建,但我无法为自定义模块创建表.如何为我的自定义模块创建表?
任何帮助,将不胜感激.
我现在迷路了.我试图使用Soap客户端,我得到以下错误
Uncaught SoapFault exception: [0] Unable to load Soap extension on the server in /opt/local/apache2/htdocs/code/import.php
Run Code Online (Sandbox Code Playgroud)
在import.php里面
$client = new SoapClient('http://mymagentowebsite.com/api/soap/?wsdl');
$session = $client->login('api_master', 'api123');
Run Code Online (Sandbox Code Playgroud)
当我到达我的phpinfo时,我能够看到我的肥皂客户端启用了

我正在使用Macports,我也安装了soap端口扩展
以下是我在php.ini中找到的内容
extension=php_soap.dll
[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
soap.wsdl_cache_enabled=1
; Sets the directory name where SOAP extension will put cache files.
; http://php.net/soap.wsdl-cache-dir
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
; http://php.net/soap.wsdl-cache-ttl
soap.wsdl_cache_ttl=86400
; Sets …Run Code Online (Sandbox Code Playgroud) 我有一个magento的管理模块.提交表单时,我希望能够显示"请等待"弹出窗口(与更改类别时获得的一样).我目前没有使用任何AJAX,但我认为我需要使用ajax提交表单.我没有任何phtml文件,因为我的表单信息是以编程方式设置的(因为它是动态的).
有人能指出我正确的方向使用magento中的"Please Wait",无论是否有AJAX?
如果您需要有关我如何显示表单的更多信息,请告诉我,因为我不知道需要哪些信息,也不想只是用随机片段填写我的帖子.
解决
只是为了清楚地保存评论:
我重写默认保存按钮以添加JS onclick:
$this->_updateButton('save', 'onclick', 'submitForm()');
Run Code Online (Sandbox Code Playgroud)
然后,我使用了一个JS文件 layout.xml
<reference name="head">
<action method="addJs"><script>mymodule/javascript.js</script></action>
</reference>
Run Code Online (Sandbox Code Playgroud)
然后添加了一个JS函数:
function submitForm(){
$('edit_form').request({
onComplete: function() {
window.location.href = document.URL;
}
})
}
Run Code Online (Sandbox Code Playgroud)
这为我排序.
我一直在寻找网络,但我似乎无法找到任何例子,我已经尝试过,但失败了.我正在使用api的第2版,我想找到按客户属性过滤的产品......
$filter = array(
array(
'key'=>'custom_attribute',
'value'=>"463"
)
);
$products = $client->catalogProductList($session,array(
'filter'=>$filter
));
Run Code Online (Sandbox Code Playgroud)
但我得到的是所有产品,而不是我要找的具体产品.有什么我做错了吗?有什么我想念的吗?
我尝试升级我的自定义Magento模块但由于某种原因它无法正常工作.
我的模块配置:
<?xml version="1.0"?>
<config>
<modules>
<MVE_CategoryAttribute>
<version>0.1.1</version>
</MVE_CategoryAttribute>
</modules>
<global>
<resources>
<categoryattribute_setup>
<setup>
<module>MVE_CategoryAttribute</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
<connection>
<use>default_setup</use>
</connection>
</categoryattribute_setup>
</resources>
</global>
</config>
Run Code Online (Sandbox Code Playgroud)
安装脚本(mysql4-install-0.1.0.php):
<?php
$this->startSetup();
$this->addAttribute('catalog_category', 'imagetext', array(
'group' => 'General Information',
'input' => 'textarea',
'type' => 'varchar',
'label' => 'Tekst op afbeelding',
'backend' => '',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->endSetup();
?>
Run Code Online (Sandbox Code Playgroud)
升级脚本(mysql4-upgrade-0.1.0-0.1.1.php):
<?php
$this->startSetup();
$this->updateAttribute('catalog_category', 'imagetext', 'global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE);
$this->endSetup();
?>
Run Code Online (Sandbox Code Playgroud) 我如何删除/关闭<span class="price">...</span>从
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
Run Code Online (Sandbox Code Playgroud)
在
<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
Run Code Online (Sandbox Code Playgroud)
我没有改变最后一个错误和价格打印的论点,<span class="price">...</span>
所以我不知道我该怎么做
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
Run Code Online (Sandbox Code Playgroud)
我不想改变核心文件.谢谢你的帮助.
嗨,我想写一个钩子.我做了一个名为BEST SELLER的类别和一个名为BESTSELLER的属性(是/否)(默认为NO)(一般情况下).当我将BEST SELLER类别分配给任何产品时,我想写一个钩子,它必须将属性BESTSELLER更改为YES,当我们从BEST SELLER类别中删除产品时,它必须将BESTSELLER属性值更改为NO.但是我发现在magento v-1.7.0.2中没有像catalog_product_save_before和catalog_product_save_after这样的事件.任何帮助请快速回复.
我有一个Magento 1.5.0.1安装,有3个不同的商店视图.在某些方面,两个商店不使用产品属性的默认值.我试图找到一种方法使所有产品都使用所有商店的默认值,这样客户只需要在一个地方更新东西.我发现这篇文章,但它似乎只适用于特别称为产品.任何人都可以解释如何在我的情况下使用该代码?或建议新代码?
我尝试了几个我可以在谷歌找到的想法,但几天没有人为我工作.最后,我发现了一种在自定义扩展中显示magento中捆绑产品的"最小可能价格"和"最大可能价格"的方法:
$_product_id = YOUR_BUNDLE_PRODUCT_ID;
// highest possible price for this bundle product
$return_type = 'max'; // because I used this in a helper method
// lowest possible price for this bundle product
// $return_type = 'min';
$model_catalog_product = Mage::getModel('catalog/product'); // getting product model
$_product = $model_catalog_product->load( $_product_id );
$TypeInstance = $_product->getTypeInstance(true);
$Selections = $TypeInstance->getSelectionsCollection($OptionIds, $_product );
$Options = $TypeInstance->getOptionsByIds($OptionIds, $_product);
$bundleOptions = $Options->appendSelections($Selections, true);
$minmax_pricevalue = 0; // to sum them up from 0
foreach ($bundleOptions as $bundleOption) {
if …Run Code Online (Sandbox Code Playgroud) 我正在尝试为magento创建一个简单的模块.我已经创建了我的控制器,我的路线但由于某种原因我无法访问我的模型.据我所知,它甚至没有加载.
我没有收到任何错误消息,并且未创建模型对象.
可能是什么导致了这个?
以下是一些信息:
控制器:
class MyVendor_MyModule_IndexController extends Mage_Core_Controller_Front_Action
{
public function pingAction(){
$model = Mage::getModel('mymodule/mymodule');
echo "<pre>" . print_r($model->load(1),true);
}
}
Run Code Online (Sandbox Code Playgroud)
模型树视图:
Run Code Online (Sandbox Code Playgroud)MyVendor -MyModule -- controllers ---- IndexController.php -- Model ---- Mysql4 -------- MyModule.php -------- MyModule ---------------- Collection.php ---- MyModule.php -- etc ---- config.xml
config.xml中
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MyVendor_MyModule>
<version>0.0.1</version>
</MyVendor_MyModule>
</modules>
<frontend>
<routers>
<mymodule>
<use>standard</use>
<args>
<module>MyVendor_MyModule</module>
<frontName>mymodule</frontName>
</args>
</mymodule>
</routers>
</frontend>
<global>
<models>
<mymodule>
<class>MyVendor_MyModule_Model</class>
<resourceModel>mymodule_mysql4</resourceModel>
</mymodule>
<mymodule_mysql4>
<class>MyVendor_MyModule_Model_Mysql4</class>
<entities>
<mymodule>
<table>mymodule_table</table>
</mymodule>
</entities>
</mymodule_mysql4> …Run Code Online (Sandbox Code Playgroud)