Would it be possible to add the choice to associate a different download file to a product option?
ex: I have a pdf in french or english for download by customers,
option is language,
option values french and english
and only one download file for both option which is not possible and make the option unusuable. I have to create a new product just for a different language. One can imagine what this means if one deal with 3 or 4 options that change a bit the file....
That would be a very useful add.
Thanks
what if i want different downloads DEPENDING on the option chosen.
We have music DVDs. The choices are
1) mp3s only
2) mp3 + .mov
3) DVD
with option 1) they get the mp3.zip file
with option 2) they get the mp3.zip file and mov.zip file
with option 3) they get the mp3.zip file and mov.zip file as well
At the moment it seems that i can only attach multiple downloads so even if they pick mp3 they also get the mov.zip file
Any ideas greatly appreciated as i'd rather not have to have seperate product pages for each option as it's nice them all being in one place.
I've played around with the admin system but don't seem to be able to do it. Anyone have any ideas?
http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk
Add both download files to the product i.e. 'Track Name mp3 version' and 'Track Name wav version'
Name the options 'mp3' and 'wav'
When customer buys the track, in the downloads section by default they currently get to download both files, no matter what option they chose.
All I have to do is only show the one that contains the string of their chosen option. E.g. if they chose 'mp3', only show 'Track Name mp3 version' for download.
This seems a lot easier than adding files to each option, which I thought I was going to have to do.
Right... now I just have to code it! Will post when I'm done.
http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk
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']) . "'");
}
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']) . "'");
}
}

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk
I've used your code, but the result is still the same. I'm having a picture to download in different sizes (L, XL, S, etc.).
I've added the sizes (L, XL, ...) as option and named the picture to download card1_L / card1_XL / etc.
When I now choose L from the option, I still get both products for download.
What have I done wrong? Any idea?
I'm using OC 1.4.9.3
Many thanks, Chris
Test it to see if it does the same thing when you buy XL. If that works then it's purely down to the naming of your options. You're going to have to think of a different way to differentiate them that doesn't use the same string, or same letter.
As I said, it's not a perfect solution I'm afraid.
http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk
Cheers, Chris
Try this instead. It splits the name by underscore and takes the last letter/word for matching. For example.
Options: Small, Medium Large
Downloadable files: image_001_small, image_001_medium, image_001_large
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']);
$tmp = split('_', $downloadname);
$size = count($tmp);
if (strtolower($optionvalue) == strtolower($tmp[$size - 1])) {
$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']) . "'");
}
}
Hope someone find that useful.
Users browsing this forum: Majestic-12 [Bot] and 77 guests