Magento – Individual options / Custom Options Datei oder Bild mit Link zum Download

Picture

It is again noticed something curiousPicturePicture: If you use Magento in the individual options, and then type the command “File”, So in order to give customers the opportunity for certain products, such as separate files. Pictures to print send along.

Default, but unfortunately not in the basket, still in the checkout still given in the order confirmation, a link or even the file itself. It is only the title of the option (here “Bild upload”). But if you're e.g.. Dropshipping use and offer already in the order confirmation email to the supplier an opportunity, to make the product, It would be nice, if he had direct access to the file.

Im rechten Bild ist nun zu sehen, as it would be nice. A Link, which also o.g. Set is displayed, and also appears in the Mail. But where is the link?

Apparently there is a Magentofehler, that the link is not visible. If you look at the pages of code in the frontend, this looks like this WITHOUT the required link

Picture

 

with the desired link it looks like

Picture

This seems to be missing something. The basic structure is already there. It lacks the full link and the link name.

Was tun, to get the link?

We have by chance the link in the first place “to know” and then used some time, to find out why it appears.
It lies on the extension Custom Product Preview von AITOC. This is really funny here namely, that you can upload with this wonderful extension texts and pictures for an article, they then move on to the product, enlarge, Decrease etc. pp.. PictureHas anyone done this, but is only an image as the product is to look after the above. Points displayed, but NOT the link to the files. This is not so with the best and therefore not usable for us was. The extension but we were installed on the system.

Well, it turned out, that a (probably unknown) Side effect of this extension is, that in ordinary products, nothing to do with the extension have, In the case of individual options in the form of files, The link will appear suddenly.

There must be so in this extension, the answer to the question, how to be a standard product with options to move the link to communicate.

AITOC itself divided on the way, demand (BEFORE we saw the phenomenon with the standard products) with, that it was not possible the file or link to this mitzugeben with the extension. There are only the previews in the enclosed function….

Now we hope to soon find out, where the secret lies, and then to give everyone the opportunity to use the desired link. Proposals are seen as more like.

Addendum dated 29.11.2016

Ein Problem scheint vor allem dann zu bestehen wenn es sich um Bündel-Produkte handelt. In diesem Fall werden auch keine Links im Backend displayed. Dies kann behoben werden indem man die renderer.phtml im Ordner app/design/adminhtml/default/default/template/bundle/sales/order/view/items anpasst.

Hier wird zu Anfang zwischen die Zeilen

<?php $_index = 0 ?>

and

<?php $_prevOptionId = '' ?>

the line

<?php $_order = $this->getItem()->getOrder(); ?>

inserted.

Anschließend noch ca. nach Zeile 382

                <dl class="item-options">
                <?php foreach ($this->getOrderOptions() as $option): ?>
                    <dt><?php echo $option['label'] ?>:</dt>
                    <dd>

folgenden Code

                    <?php  
                        $optionValues = unserialize($option['option_value']);
                        if(isset($optionValues['url'])){
                            $url = Mage::getUrl(
                                $optionValues['url']['route'],
                                array(
                                    '_store' => $_order->getStoreId(),
                                    'id' => $optionValues['url']['params']['id'],
                                    'key' => $optionValues['url']['params']['key']
                                )
                            );
                        } else {
                            $url = '';
                        }
                    ?>
                    <?php if($url!='') { echo '<a href="'.$url.'" target="_blank">'.$optionValues['title'].'</a>'; } ?>

Anschließend werden die Links für Bündelprodukte im Backend angezeigt.

Addendum dated 30.11.2016

Nun haben wir auch eine Anpassung vorgenommen, um die Links zu den Bildern in den Transaktionsemails anzeigen zu lassen.

For Simple products wird hier die Datei /app/design/frontend/base/default/template/email/order/items/order/default.phtml

required (am besten wieder in den eigenen Template-Ordner kopieren und dort anpassen).

Man fügt nach

<dd style="margin:0; padding:0 0 0 9px;">

(as. Line 36) folgenden Code ein

                <?php  
                    $optionValues = unserialize($option['option_value']);
                    $url = '';

                    if(isset($optionValues['url']['route'])) {
                        $url = Mage::getUrl(
                        $optionValues['url']['route'],
                        array(
                            '_store' => $_order->getStoreId(),
                            'id' => $optionValues['url']['params']['id'],
                            'key' => $optionValues['url']['params']['key']
                            )
                        );
                    }
                        
                    //var_dump($url);exit;
                ?>
                <?php if($url!=''): ?>
                    <?php echo '<a href="'.$url.'" target="_blank">'.$optionValues['title'].'</a>'; ?>
                <?php else: ?>
                    <?php echo $option['value'] ?>
                <?php endif; ?>
            </dd>

und ersetzt damit den Code

<?php echo $option['value'] ?></dd>

Das war es dann hier.

For Bündel Produkte wird hingegen die Datei /app/design/frontend/base/default/template/bundle/email/order/items/order/default.phtml (or. im eigenen Template)

Dort fügt man folgenden Code nach

<dd style="margin:0; padding:0 0 0 9px;">

(as. Line 159) a.

                <?php  
                    $optionValues = unserialize($option['option_value']);
                    $url = '';

                    if(isset($optionValues['url']['route'])) {
                        $url = Mage::getUrl(
                        $optionValues['url']['route'],
                        array(
                            '_store' => $_order->getStoreId(),
                            'id' => $optionValues['url']['params']['id'],
                            'key' => $optionValues['url']['params']['key']
                            )
                        );
                    }
                        
                    //var_dump($url);exit;
                ?>
                <?php if($url!=''): ?>
                    <?php echo '<a href="'.$url.'" target="_blank">'.$optionValues['title'].'</a>'; ?>
                <?php else: ?>
                    <?php echo $option['value'] ?>
                <?php endif; ?>
            </dd>

und ersetzt damit

<?php echo $option['value'] ?></dd>

Nun werden in der eMail auch die Links zu der hochgeladenen Datei angezeigt und diese können direkt aus der eMail angeklickt und geöffnet werden.

Used in Magento Version 1.4.1.1 Comments? Additions? Notes? Gladly!

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

Leave a Reply

Your email address will not be published. Required fields are marked *