Post by teamweb » Wed Jan 05, 2011 11:41 pm

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
Last edited by teamweb on Thu Jan 06, 2011 10:44 pm, edited 1 time in total.

Newbie

Posts

Joined
Sun Nov 21, 2010 6:48 am

Post by openmycart.com » Thu Jan 06, 2011 12:50 am

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

Find and get many various of opencart modules, themes, mods, etc for your opencart store at http://www.openmycart.com/oc/, OPENCART SITE customization and Maintenance supports at here


User avatar
Active Member

Posts

Joined
Tue Oct 12, 2010 4:47 am


Post by teamweb » Thu Jan 06, 2011 10:44 pm

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.

Newbie

Posts

Joined
Sun Nov 21, 2010 6:48 am

Post by openmycart.com » Fri Jan 07, 2011 12:37 am

nice to hear it, if You find any problem You can put it here..

Find and get many various of opencart modules, themes, mods, etc for your opencart store at http://www.openmycart.com/oc/, OPENCART SITE customization and Maintenance supports at here


User avatar
Active Member

Posts

Joined
Tue Oct 12, 2010 4:47 am

Who is online

Users browsing this forum: paulfeakins and 6 guests