У меня есть небольшая проблема.
Я хочу, чтобы фильтр admin sales order view
коллекция.
Я пробовал, но не смог найти файл коллекции.
помогите пожалуйста.Magento заказ для заказа посмотреть фильтр фильтра
0
A
ответ
0
<sales_order_item_collection_load_before>
<observers>
<set_discount_new_customer>
<type>singleton</type>
<class>modulename_customattribute/observer</class>
<method>filterCollection</method>
</set_discount_new_customer>
</observers>
</sales_order_item_collection_load_before>
В файле Observer:
public function filterCollection($observer)
{
$rawnew = $observer->getOrderItemCollection();
$rawnew->addFieldToFilter('mycustom_attribute',6);
return $rawnew;
}
Благодаря R, S для придания подсказки.
0
Попробуйте это, Его работа для меня,
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
//echo $name = Mage::app()->getStore()->getId();
$orders = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('status', 'pending')
->addAttributeToSelect('customer_email', '[email protected]')
;
foreach ($orders as $order) {
$email = $order->getCustomerEmail();
echo $email . "\n";
}
0
Вы должны быть в состоянии сделать это с помощью наблюдателя
в config.xml
<adminhtml>
<events>
<sales_order_grid_collection_load_before>
<observers>
<magepal>
<type>singleton</type>
<class>magepal/observer</class>
<method>handleOrderCollectionLoadBefore</method>
</magepal>
</observers>
</sales_order_grid_collection_load_before>
В вашем наблюдателя
public function handleOrderCollectionLoadBefore($observer)
{
$collection = $observer->getOrderGridCollection();
// $collection->addFieldToFilter('status', 'pending');
// you may need to do additional check to make sure that the filter is only apply to specific section
R.S Спасибо за подсказку. Если я хочу использовать наблюдателя, чтобы вычислить грандиозное произведение, ниже которого идет желтый цвет ... можно ли это сделать? –