我正在尝试在终端中更改我的命令promt.我一直收到错误:
-bash: __git_ps1: command not found
我只是通过在终端中键入它来尝试它:__git_ps1
.我也试过了.bash_profile
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
export PS1='[\W]$(__git_ps1 "(%s)"): '
fi
Run Code Online (Sandbox Code Playgroud)
正如您可能看到/告诉的那样,是的,我确实已经安装了自动完成功能,它确实很有效!
我遇到了这个问题:" PS1 env变量在mac上不起作用 ",它给出了代码
alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
所以我把它添加到我的.bash_profile
希望它会改变一些东西.嗯,确实如此.它只是改变了错误输出.
这是.bash_profile
添加的:
alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
export PS1='[\W]$(__git_ps1 "(%s)"): '
fi
Run Code Online (Sandbox Code Playgroud)
现在这里是改变的错误输出:
sed: (%s): No such file or directory
注意:我也将源下的别名移动到没有区别.我有 git版本1.7.12.1 …
快速查看:我想从一组特定的返回结果静态块到PHTML文件(该文件,然后从一个叫上CMS页面中)的Magento.
注意:我一直在搜索谷歌和一些答案让我比其他人更接近,但我尝试过的任何东西似乎100%工作?
细节:
我已经有一组特定的静态块,都以标识符开头testimonial-
.例如,每个静块是这样的:testimonial-1
,testimonial-2
,testimonial-3
等.我在我的开发网站上总共有5个(更多关于现场网站,但这并不重要).
我有一个带有代码的CMS页面name.phtml
(文件的位置在这里:app/design/frontend/[package]/[template]/template/page /):
{{block type="core/template" template="page/name.phtml" title="Others Say:" identifier="testimonial-"}}
Run Code Online (Sandbox Code Playgroud)
这是我的.phtml文件的代码:
<?php
// add the collection with filters
$collection = Mage::getModel('cms/block')->getCollection()
->addFieldToFilter('identifier', array('like'=>'testimonial'.'%'))
->addFieldToFilter('is_active', 1);
// get the count
$blockCount = $collection->count();
echo 'Block Count: ' . $blockCount . '<br />'; // just for testing
$blockNum = 1;
foreach($collection as $key => $value){
$_blockId = …
Run Code Online (Sandbox Code Playgroud) 因此,当数量字段大于0时,我一直在寻找一种方法将库存可用性更改回库存.当您将数量设置为0并保存产品时,系统已自动将库存可用性更改为缺货.当您将数量设置为大于0并保存产品时,我想要一种方法将其设置回库存.
好吧,我想我发现了一种简单的方法,这本身就让我感到紧张.所以我想向大师们发帖,看看这是否安全,正确,还可以.
在app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml中
我改变了这个:
<?php foreach ($this->getStockOption() as $option): ?>
<?php $_selected = ($option['value'] == $this->getFieldValue('is_in_stock')) ? 'selected="selected"' : '' ?>
<option value="<?php echo $option['value'] ?>" <?php echo $_selected ?>><?php echo $option['label'] ?></option>
<?php endforeach; ?>
Run Code Online (Sandbox Code Playgroud)
对此:
<?php if( ($this->getFieldValue('qty')*1) > 0): ?>
<option selected="selected" value="1">In Stock</option>
<?php else: ?>
<option selected="selected" value="0">Out of Stock</option>
<?php endif; ?>
Run Code Online (Sandbox Code Playgroud)
我现在所有的工作都是一个现场网站,所以你可以理解我的关注......
请告诉我这是否会产生预期效果(看起来如此,但似乎过于简单......)
问题是,当我过滤订单导出时,有时我会在Google Chrome中收到此错误:
Duplicate headers received from server
The response from the server contained duplicate headers. This problem is generally the result of a misconfigured website or proxy. Only the website or proxy administrator can fix this issue.
Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.
Run Code Online (Sandbox Code Playgroud)
我在谈论Sales > Orders
屏幕.
假设我按订单号过滤它,这样我只想将1个实际订单导出到.csv文件.
在FF,IE等,这似乎工作.而且大多数时候它也适用于Chrome(16 - 最新版本发布时).
根据这篇文章:'从服务器收到的重复标题'在Chrome 16中与EPPlus 2.9的错误,他能够推断它与","作为分隔符有关.
我试着去lib/Varien/File/Csv.php
改变界限到";" 但那似乎不起作用......
有人有什么建议吗?
注意: Chrome本身有一些修复(我认为),但如果可能,我想通过Magento修复它.
快速提问(阅读时请记住这一点):
为什么会产生此错误(在解释中)以及如何编辑pdfRmaAction()
以正常工作(批量操作打印)?
**在Magento工作,v.1.10.1.0
和v.1.5.1.0
冗长的解释:
我已下载此扩展程序(http://www.magentocommerce.com/magento-connect/admin-order-printing-extension.html),为每个订单添加一个按钮,这样当您进入订单时,您就拥有了用于打印RMA的额外按钮(根据此扩展程序自定义模型pdf - 根据发票变成自定义RMA表单)
它很棒.但是,我想向其添加批量操作打印,以便您可以检查一些订单并从下拉列表中选择打印RMA并打印这些订单的表单.
在扩展config.xml
文件(app/code/local/Nastnet/OrderPrint/etc /)中,<config>
标签内部是这样的:
<modules>
<Nastnet_OrderPrint>
<version>0.1.3</version>
</Nastnet_OrderPrint>
</modules>
<global>
<blocks>
<adminhtml>
<rewrite>
<sales_order_grid>Nastnet_OrderPrint_Block_Sales_Order_Grid</sales_order_grid> <!-- ADDED THIS FOR MASS ACTION PRINTING -->
<sales_order_view>Nastnet_OrderPrint_Block_Sales_Order_View</sales_order_view>
</rewrite>
</adminhtml>
</blocks>
<rewrite>
<Nastnet_OrderPrint_OrderController>
<from><![CDATA[#/\w+/sales_order/print/#]]></from>
<to>/orderprint/order/print/</to>
</Nastnet_OrderPrint_OrderController>
</rewrite>
<models>
<Nastnet_OrderPrint>
<class>Nastnet_OrderPrint_Model</class>
</Nastnet_OrderPrint>
</models>
<pdf>
<order>
<default>Nastnet_OrderPrint/order_pdf_items_order_default</default>
<grouped>Nastnet_OrderPrint/order_pdf_items_order_grouped</grouped>
</order>
</pdf>
</global>
<admin>
<routers>
<Nastnet_OrderPrint>
<use>admin</use>
<args>
<module>Nastnet_OrderPrint</module>
<!-- This is used when "catching" the …
Run Code Online (Sandbox Code Playgroud) 因此,当您在Magento中执行贷项凭单时,它将存货重新设置为正确的水平,但不会将“缺货”更改回“有货”(如果适用)。我在Wright Creatives(http://wrightcreativelabs.com/blog/55-credit-memo-in-stock.html)上看到了这篇文章,它解决了这个问题。但是,方法太慢了!每个产品大约需要30秒。
我最终不得不删除它作为解决方案(因为“速度”),现在我的老板希望重新实现该功能。
我知道is_in_stock
数据控制着这个问题,我想知道是否已经有一个模块,一篇文章/教程,或者有人可以帮助我着手“更好/更快”的解决方案。
通过此问答,我找到了将客户电子邮件地址放在Magento管理销售订单网格上的好方法(http://stackoverflow.com/questions/6416864/how-to-add-customer-email-to-order-grid- in-magento-1-4/6906254#6906254)Ben Incani,它的效果很好.
我的问题是:使用此方法,如何将Ship添加到信息(名称,地址,城市,州,邮政编码)?
我试过做两个版本(那种工作)但是没有完全工作所以我有点卡住了......
这是适用于客户电子邮件的代码:
$collection->getSelect()->joinLeft(array('sfo'=>'sales_flat_order'),'sfo.entity_id=main_table.entity_id',array('sfo.customer_email', 'sfo.shipping_description'));
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试进入具有Ship to信息的数据库表时,我尝试了这个:
$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'),'sfoa.parent_id=sfo.entity_id',array('sfoa.postcode'));
Run Code Online (Sandbox Code Playgroud)
这将返回错误日志,其中包含以下消息:
a:5:{i:0; s:68:"Item(Mage_Sales_Model_Order)具有相同的id"10860"已经存在"; i:1; s:5104:"#0
尝试此代码(最接近原始客户电子邮件代码):
$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'),'sfoa.entity_id=main_table.entity_id',array('sfoa.postcode'));
Run Code Online (Sandbox Code Playgroud)
产生一个我可以用填充列查看的网格.但是,列中的值不是正确的邮政编码 - 我甚至无法弄清楚它拉的是什么值?
我想我的一个问题是我不知道main_table.entity_id指的是什么(虽然我有猜测).
无论如何,我觉得我很亲密,如果有人能回答我用这种方法成功获得信息的方式,我将永远感激不尽!任何人都可以
我更改了app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php来自定义Orders网格上的内容.
在_getCollectionClass()
我有这样的:
protected function _getCollectionClass()
{
//return 'sales/order_grid_collection';
return 'sales/order_collection';
}
Run Code Online (Sandbox Code Playgroud)
在_prepareCollection()
我有这个:
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array('s1' => 'sales_flat_order_address'),'main_table.shipping_address_id = s1.entity_id',array('region','firstname','lastname'));
$collection->getSelect()->joinLeft(array('s2'=>'sales_flat_order_address'),'main_table.billing_address_id = s2.entity_id',array('firstname','lastname'));
$collection->getSelect()->columns(new Zend_Db_Expr("CONCAT(s2.firstname, ' ',s2.lastname) AS billing_name"));
$collection->getSelect()->columns(new Zend_Db_Expr("CONCAT(s1.firstname, ' ',s1.lastname) AS shipping_name"));
$collection->getSelect()->joinLeft(array('sfo'=>'sales_flat_order'),'sfo.entity_id=main_table.entity_id',array('sfo.customer_email','sfo.weight','sfo.discount_description','sfo.increment_id','sfo.store_id','sfo.created_at','sfo.status','sfo.base_grand_total','sfo.grand_total')); // New
$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'),'main_table.entity_id = sfoa.parent_id AND sfoa.address_type="shipping"',array('sfoa.street','sfoa.city','sfoa.region','sfoa.postcode','sfoa.telephone')); // New
$this->setCollection($collection);
return parent::_prepareCollection();
}
Run Code Online (Sandbox Code Playgroud)
现在我已经改变了_prepareColumns()
添加我必要的字段,所有的工作都很棒!除了一件事...
当我通过Billing或Shipping搜索订单时,出现错误.我已经将filter_index的('filter_index' => 'theindex'
)添加到所有必要的组件中,除了这两个字段Billing或Shipping之外,它们都工作得很好.
所以我也把 …
在订单视图(查看客户订单时的主屏幕)中,我想添加一些表格行并添加客户的终身销售(总销售额)和订单总金额.
我要添加代码的文件在这里:app/design/adminhtml/default/default/template/sales/order/view/info.phtml
在此文件中,如下:
<?php foreach ($this->getCustomerAccountData() as $data):?>
<tr>
<td class="label"><label><?php echo $data['label'] ?></label></td>
<td class="value"><strong><?php echo $data['value'] ?></strong></td>
</tr>
<?php endforeach;?>
Run Code Online (Sandbox Code Playgroud)
是我用正确的信息添加我需要的行/单元格的地方.你能告诉我如何获得必要的数据吗?