Page 1 of 1

[Solved ]Downloadable files mod - Paid work

Posted: Wed Jan 05, 2011 11:41 pm
by teamweb
What we need:
When adding a product you should be able to add options and to thoose options select file (one for each option).

Why is this needed? Our client sells images and they want to sell web (smaller) and print- versions of a image. So one way would be to add double products to get the right image-size. But it should be more smoother if file's where selected by the option dropdown instead.

OC Version: 1.4.9.x

This work is paid, send qoute to corre ( a ) teamweb . se

Re: Downloadable files mod - Paid work

Posted: Thu Jan 06, 2011 12:50 am
by openmycart.com
I found this:

Basically, in catalog > model > checkout > order.php find this:

Code: Select all

    foreach ($product['download'] as $download) {
                $this->db->query("INSERT INTO " . DB_PREFIX . "order_download SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', name = '" . $this->db->escape($download['name']) . "', filename = '" . $this->db->escape($download['filename']) . "', mask = '" . $this->db->escape($download['mask']) . "', remaining = '" . (int)($download['remaining'] * $product['quantity']) . "'");
             }
Replace it with the following, which just checks if the name of the download contains the option

Code: Select all

    foreach ($product['download'] as $download) {

    $valuequery = $this->db->query("SELECT value FROM `" . DB_PREFIX . "order_option` WHERE order_product_id = '" . (int)$order_product_id . "'");
    $optionvalue = $valuequery->row['value'];
    $downloadname = $this->db->escape($download['name']);
    if (strstr($downloadname, $optionvalue)) {

                $this->db->query("INSERT INTO " . DB_PREFIX . "order_download SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', name = '" . $this->db->escape($download['name']) . "', filename = '" . $this->db->escape($download['filename']) . "', mask = '" . $this->db->escape($download['mask']) . "', remaining = '" . (int)($download['remaining'] * $product['quantity']) . "'");
                }
             }
from: http://forum.opencart.com/viewtopic.php?f=20&t=4084
if this can help You then just say thanks to developer

Re: Downloadable files mod - Paid work

Posted: Thu Jan 06, 2011 10:44 pm
by teamweb
Thanks alot Openmycart.com and to Chones who helped me with this problem.

I will add dropdownlist where my option is and display downloaded objects so there can be no miss spelling.

Re: [Solved ]Downloadable files mod - Paid work

Posted: Fri Jan 07, 2011 12:37 am
by openmycart.com
nice to hear it, if You find any problem You can put it here..