什么';这是$this的功能->;magento中success.phtml中的getCanViewOrder()
我试图找出以下函数正在检查什么:什么';这是$this的功能->;magento中success.phtml中的getCanViewOrder(),magento,Magento,我试图找出以下函数正在检查什么: <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?> <?php echo $this->__('<strong><a href="%s" onclick="this.target=\'_blank\'">Click here to print</a></strong> a
<?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
<?php echo $this->__('<strong><a href="%s" onclick="this.target=\'_blank\'">Click here to print</a></strong> an invoice or a copy of your order confirmation.', $this->getPrintUrl()) ?>
在Magento中的
success.phtml
文件中,“单击此处打印”链接不再显示在感谢页面上。这个函数在哪里?更新:在做了更多的研究之后,我对这个答案做了很大的修改
对于记录,它看起来像是
getCanPrintOrder
是Magento获取对象数据的神奇方法之一。您可以使用setCanPrintOrder
设置它的值,如果您以前没有调用过它,getCanPrintOrder
将只返回null
。您也可以通过调用setData('can\u print\u order')
进行设置
它看起来唯一要设置的位置是在\u prepareLastOrder
方法中的Onepage签出成功块Mage\u checkout\u block\u Onepage\u success
:
protected function _prepareLastOrder()
{
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
if ($orderId) {
$order = Mage::getModel('sales/order')->load($orderId);
if ($order->getId()) {
$isVisible = !in_array($order->getState(),
Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
$this->addData(array(
'is_order_visible' => $isVisible,
'view_order_id' => $this->getUrl('sales/order/view/', array('order_id' => $orderId)),
'print_url' => $this->getUrl('sales/order/print', array('order_id'=> $orderId)),
'can_print_order' => $isVisible,
'can_view_order' => Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible,
'order_id' => $order->getIncrementId(),
));
}
}
}
它是从\u beforeToHtml
方法调用的,该方法将在呈现该页面时调用
将字符串拉远一点,我们可以看到可以打印\u顺序
是由$isVisible
变量决定的,这是由以下行设置的:
$isVisible = !in_array($order->getState(),
Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
它检查订单状态是否是在前端可见的状态之一。这些最终在核心Magento销售模块的config.xml
文件中设置
<config>
<global>
<sales>
<order>
<states>
<new translate="label">
<label>New</label>
<statuses>
<pending default="1"/>
</statuses>
<visible_on_front>1</visible_on_front>
</new>
...
</states>
</order>
</sales>
</global>
</config>
高于if条件的任何位置。或者干脆取消所有的检查。更新:在做了更多的研究之后,我对这个答案做了很大的修改
对于记录,它看起来像是
getCanPrintOrder
是Magento获取对象数据的神奇方法之一。您可以使用setCanPrintOrder
设置它的值,如果您以前没有调用过它,getCanPrintOrder
将只返回null
。您也可以通过调用setData('can\u print\u order')
进行设置
它看起来唯一要设置的位置是在\u prepareLastOrder
方法中的Onepage签出成功块Mage\u checkout\u block\u Onepage\u success
:
protected function _prepareLastOrder()
{
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
if ($orderId) {
$order = Mage::getModel('sales/order')->load($orderId);
if ($order->getId()) {
$isVisible = !in_array($order->getState(),
Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
$this->addData(array(
'is_order_visible' => $isVisible,
'view_order_id' => $this->getUrl('sales/order/view/', array('order_id' => $orderId)),
'print_url' => $this->getUrl('sales/order/print', array('order_id'=> $orderId)),
'can_print_order' => $isVisible,
'can_view_order' => Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible,
'order_id' => $order->getIncrementId(),
));
}
}
}
它是从\u beforeToHtml
方法调用的,该方法将在呈现该页面时调用
将字符串拉远一点,我们可以看到可以打印\u顺序
是由$isVisible
变量决定的,这是由以下行设置的:
$isVisible = !in_array($order->getState(),
Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
它检查订单状态是否是在前端可见的状态之一。这些最终在核心Magento销售模块的config.xml
文件中设置
<config>
<global>
<sales>
<order>
<states>
<new translate="label">
<label>New</label>
<statuses>
<pending default="1"/>
</statuses>
<visible_on_front>1</visible_on_front>
</new>
...
</states>
</order>
</sales>
</global>
</config>
高于if条件的任何位置。或者干脆取消支票