我正在使用此代码检查网站上的语言,然后从我的下拉菜单中删除它.该代码适用于Firefox,但无法在chrome上运行,也会停止所有其他脚本.这是代码:
var mylangme = $(location).attr('href');
if(mylangme.contains("/fr/")){
mylangme="French";
$(".subnav li:first-child").css("display","none");
}
if(mylangme.contains("/nl/")){
mylangme="Dutch";
$(".subnav li:nth-of-type(2)").css("display","none");
}
if(mylangme.contains("/ru/")){
mylangme="Russian";
$(".subnav li:nth-of-type(3)").css("display","none");
}
if(mylangme.contains("/en/")){
mylangme="English";
$(".subnav li:last-child").css("display","none");
}
Run Code Online (Sandbox Code Playgroud) 我对于安装社区扩展很不以为然,即使我的版本控制也是如此.有没有办法获得tgz所以我可以解压缩它并在安装之前检查扩展?
我试图在Magento 1.7.0.2的产品视图页面上显示分组产品的价格,就像它显示在类别产品列表中一样("起始于:xx.xx").我以为我可以用
$this->getPriceHtml($_product, true);
Run Code Online (Sandbox Code Playgroud)
这样做是因为它在类别产品列表中的工作方式相同,但是作为我在Magento中尝试做的所有事情,它并不那么容易,因为该方法不会在产品视图页面上返回任何内容.
我更深入地了解了Magento的代码,并发现问题的原因是产品视图页面上没有设置产品的最低价格数据($ _product-> getMinimalPrice()返回null).
因此,我做了一些关于如何加载产品最低价格的研究,这提出了类似的想法
$_product->getPriceModel()->getMinimalPrice($_product);
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为显然该方法已被弃用并在最后一次更新中被删除或
$priceModel = Mage::getResourceModel('catalogindex/price');
$priceModel->setStoreId(Mage::app()->getStore()->getId());
$priceModel->setCustomerGroupId(Mage::getSingleton('customer/session')->getCustomerGroupId());
$minimalPrices = $priceModel->getMinimalPrices(array($_product->getId()));
$minimalPrice = $minimalPrices[0];
$_product->setData('minimal_price', $minimalPrice['value']);
$_product->setData('minimal_tax_class_id', $minimalPrice['tax_class_id']);
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为表'catalogindex_minimal_price'为空.
所以我的问题是,Magento如何在产品列表中加载最低价格?
这与这个问题有关,但有不同的看法.
在Ubuntu中,我使用Autokey,它使用python自动化它观察到的击键.所以我已经<super>+e映射到打开<shift>+<super>+3Gedit,打开OOwriter等等.当我进行其中一个调用时,我不能再创建另一个调用,直到上一个调用的程序退出.
以下是它执行的脚本示例:
import subprocess
subprocess.call("/opt/openoffice.org3/program/scalc")
Run Code Online (Sandbox Code Playgroud)
...使用相同的行为:
import os
os.system("/opt/openoffice.org3/program/scalc")
Run Code Online (Sandbox Code Playgroud)
这一切都在我之前的Ubuntu 10.04LTS中顺利运行,但事情发生了变化,我不能再重复这些调用了.
你能不能帮我解决如何分叉或做一些事情从subprocess.call()"回来"而不等待程序退出?我试过nohup和后台,/opt/openoffice.org3/program/scalc &但那些什么都不做(可能在Autokey和Py中打破了一些东西)
答:下面的答案实际上并没有起作用,但让我窥探更多,我发现另一个SO答案对我的情况有效!
#Enter script code -- mapped to <super>+e
import thread
thread.start_new_thread(os.system,('gedit',))
Run Code Online (Sandbox Code Playgroud)
这完全奏效!! 我可以连续打<super>+e2到3次,并且不断向gedit添加标签.:)此脚本使Autokey的行为就像在命令行中键入引号中的命令一样.