Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Modul beépítés probléma Level 2 :)
 
Pro Digital
Sr. Member
 
Avatar
Total Posts:  110
Joined:  2007-12-05
Hungary
 

Képek az adminban:

How can i include image in the sales table in admin?

This file need to know a variable with the link to the product image but i cant configure it:

magento/app/design/adminhtml/default/default/template/sales/order/view/items/info.phtml
Have an idea for it?

---------------

Hello,

1. first of all you need to create /magento/app/code/local/Mage/MyCustomizations/Block/ and /magento/app/code/local/Mage/MyCustomizations/etc/ folders.

2. you need to create Items.php in the /magento/app/code/local/Mage/MyCustomizations/Block/ folder:

<?php                                     
class Mage_MyCustomizations_Block_Items extends Mage_Adminhtml_Block_Sales_Order_View_Items
{
    
protected $products = array();
    public function 
getItemsCollection()
    
{
        $itemsCollection 
$this->getOrder()->getItemsCollection();
        foreach (
$itemsCollection as $item{
            $products[] 
$item->getProductId();
        
}
        $productsCollection 
Mage::getModel('catalog/product')->getCollection()
            ->
setStoreId($this->getOrder()->getStoreId())
            ->
addIdFilter($products)
            ->
addAttributeToSelect('thumbnail');
        foreach (
$itemsCollection as $item{
            $item
->setProduct($productsCollection->getItemById($item->getProductId()));
        
}
        
return $itemsCollection;
    
}
}

3. you need to create config.xml in the /magento/app/code/local/Mage/MyCustomizations/etc/ folder:

<?xml version="1.0"?>
<config>
    <
modules>
        <
Mage_MyCustomizations>
            <
version>0.1.0</version>
        </
Mage_MyCustomizations>
    </
modules>

    <global>
        <
models>
        </
models>
        <
blocks>
            <
mycustomizations>
                <class>
Mage_MyCustomizations_Block</class>
            </
mycustomizations>             
            <
adminhtml>
                <
rewrite>
                    <
sales_order_view_items>Mage_MyCustomizations_Block_Items</sales_order_view_items>
                </
rewrite>
            </
adminhtml>
        </
blocks>
    </global>

    <
stores>
        <
admin>
            <
design>
                <
package>
                    <
name>default</name>
                </
package>
                <
theme>
                    <default>
mycustomizations</default>
                </
theme>
            </
design>
        </
admin>
    </
stores>
</
config>
4. you need to create /magento/app/design/adminhtml/default/mycustomizations/template/sales/order/view/items/ folder.

5. and copy /magento/app/design/adminhtml/default/default/template/sales/order/view/items/info.phtml there.

6. go to /magento/app/etc/modules/ and create there Mage_MyCustomizations.xml:

<?xml version="1.0"?>
<config>
    <
modules>
        <
Mage_MyCustomizations>
            <
active>true</active>
            <
codePool>local</codePool>
            <
depends>
                <
Mage_Adminhtml/>
            </
depends>
        </
Mage_MyCustomizations>
    </
modules>
</
config>
and you should work with the new info.phtml after this.

best regards,
Serge

7. after all these steps you are free to use the next image source wherever you want in the new /magento/app/design/adminhtml/default/mycustomizations/template/sales/order/view/items/info.phtml:

$this->helper('catalog/image')->init($this->getEntity()->getProduct(), 'thumbnail');

proposed usage:

<img src="<?php echo $this->helper('catalog/image')->init($this->getEntity()->getProduct(), 'thumbnail')->resize(50, 50); ?>" width="50" height="50" />
Best regards,
Serge

----------------------
Hogy a konfigurálható képe is jó legyen:

hello,

please update your /magento/app/code/local/Mage/MyCustomizations/Block/Items.php:

<?php                                     
class Mage_MyCustomizations_Block_Items extends Mage_Adminhtml_Block_Sales_Order_View_Items
{
    
protected $imgProducts = array();
    protected 
$imgProductId 0;
    public function 
getItemsCollection()
    
{
        $itemsCollection 
$this->getOrder()->getItemsCollection();
        foreach (
$itemsCollection as $item{
            
if ($item->getSuperProductId() === NULL{
                $imgProductId 
$item->getProductId();
            
else {
                $imgProductId 
$item->getSuperProductId();
            
}
            $imgProducts[] 
$imgProductId;
            
$item->setImgProductId($imgProductId);
        
}
        $productsCollection 
Mage::getModel('catalog/product')->getCollection()
            ->
setStoreId($this->getOrder()->getStoreId())
            ->
addIdFilter($imgProducts)
            ->
addAttributeToSelect('thumbnail');
        foreach (
$itemsCollection as $item{
            $item
->setProduct($productsCollection->getItemById($item->getImgProductId()));
        
}
        
return $itemsCollection;
    
}
}
it should help you to get images for both simple and configurable products.

best regards,
Serge

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pro Digital
Sr. Member
 
Avatar
Total Posts:  110
Joined:  2007-12-05
Hungary
 

Ezzel az 1.1.3-as verzióig minden rendben is volt de megváltozott az admin/sales struktúra és valamiért nem müködik a következő segítséget kaptam de nem boldogulok vele :

ezt írtam a variennek:

i found that the original modifications used items.php but the new release uses a default.php in a renderer folder…

A válasz:

Basically everything with customization is fine except one thing, info.phtml. The changes that you and Sergey did there won’t work for 1.1.3, because there is no such template anymore.

Currently everything that needs to be done is to edit sales/order/view/items.phtml and add there new column with image similar to how you did it before in info.phtml

Basically there is no need to go inside renderers because image isn’t dependent on product kind, the rest should be working fine, however again it will be up to you to play, test and see how it is really working out, that’s the beauty of customizations!

Nagyon hálás lennék ha valaki tudna segíteni mert én nem boldogulok vele....

Előre is köszönök minden segítséget

Ãœdv,
Tibi

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top