Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Egoods: Multiple downloadable files for each product.

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 08-09-2006, 09:15 AM
 
admintds admintds is offline
 

Newbie
  
Join Date: Aug 2006
Posts: 4
 

Default

Anyone have this going on 4.0??? I ALMOST had it...but I'm getting an sql error across the top of the page when I use this. Something to do with the database? I did get additional ESD boxes to appear on my add new product page...but after you save your esd's a y appears in the space instead of the download file so the downloads aren't linked anymore. Hmmm. Any ideas of what I'm doing wrong?


Quote:
Originally Posted by Stevemike
Greetings all!

Here is the code changes and additions to add the ability to
have up to six distribution files per product. You can of course
change the code to add more if you want, but six was the right
amount for my needs.

This is a modification of X-Cart Pro 3.5.3

I am new to mysql and php, so I don't know if I made a mistake with
the first line to rename the 'distribution' column to 'distribution1'.
I made the changes to the 'xcart_products' table by hand using
myPHPadmin, so I didn't actually use the code below to alter the table.

Some of the changes I listed below require you to search and replace
the variable and column names in the files. I didn't list the code
for those files because they just required a simple search and replace.

Please let me know if you need any more details on the mod. This is
my first mod, so it's a little sloppy.

SQL stuff:

Code:
ALTER TABLE `xcart_products` CHANGE `distribution` `distribution1` varchar(255) NOT NULL; ALTER TABLE `xcart_products` ADD `distribution2` varchar(255) NOT NULL default '' AFTER `distribution1`, ADD `distribution3` varchar(255) NOT NULL default '' AFTER `distribution2`, ADD `distribution4` varchar(255) NOT NULL default '' AFTER `distribution3`, ADD `distribution5` varchar(255) NOT NULL default '' AFTER `distribution4`, ADD `distribution6` varchar(255) NOT NULL default '' AFTER `distribution5`;


-------------------
customer/cart.php
-------------------

Code:
Code section: # # Do addition to cart # With options # $options=array(); if(!empty($product_options)) { if (is_array($product_options)) foreach($product_options as $key=>$product_option) $product_options[$key] = stripslashes($product_option); if ($active_modules["Product_Options"]) func_check_product_options ($productid, $product_options); foreach($product_options as $key=>$product_option) $options[]=array("optclass"=>$key,"optionindex"=>$product_option); } $found = false; if (!empty($cart) and @$cart["products"] and $added_product["product_type"]!="C") { foreach ($cart["products"] as $k=>$v) { if (($v["productid"] == $productid) && (!$found) && ($v["options"] == $options) && empty($v["hidden"])) { $found = true; # Changed $distribution to $distribution1 and distribution to distribution1 $distribution1 = array_pop(func_query_first("select distribution1 from $sql_tbl[products] where productid='$productid'")); if (($cart["products"][$k]["amount"] >=1) && ($distribution1)) {$cart["products"][$k]["amount"]=1; $amount=0;} $cart["products"][$k]["amount"] += $amount; } } }

---------------------
customer/download.php
---------------------

Code:
# # $Id: download.php,v 1.20.2.2 2003/12/10 11:52:36 mclap Exp $ # # This module adds support for downloading electronicaly distributed goods # require "./auth.php"; if ($HTTP_GET_VARS["action"] != "get") { # # Prepare the appearing of download page # include $xcart_dir."/include/categories.php"; if ($id) { $productid = array_pop(func_query_first("SELECT productid FROM $sql_tbl[download_keys] WHERE download_key = '$id'")); if ($productid) { $product_data = func_query_first("SELECT * FROM $sql_tbl[products] WHERE productid='$productid'"); if($active_modules["Extra_Fields"]) { $extra_fields_provider=$product_data["provider"]; include $xcart_dir."/modules/Extra_Fields/extra_fields.php"; } $smarty->assign("product", $product_data); # Change: pass urls for each file. if ($product_data["distribution1"] != "") { $smarty->assign("url1", $http_location."/customer/download.php?".$QUERY_STRING."&action=get&file=1"); } if ($product_data["distribution2"] != "") { $smarty->assign("url2", $http_location."/customer/download.php?".$QUERY_STRING."&action=get&file=2"); } if ($product_data["distribution3"] != "") { $smarty->assign("url3", $http_location."/customer/download.php?".$QUERY_STRING."&action=get&file=3"); } if ($product_data["distribution4"] != "") { $smarty->assign("url4", $http_location."/customer/download.php?".$QUERY_STRING."&action=get&file=4"); } if ($product_data["distribution5"] != "") { $smarty->assign("url5", $http_location."/customer/download.php?".$QUERY_STRING."&action=get&file=5"); } if ($product_data["distribution6"] != "") { $smarty->assign("url6", $http_location."/customer/download.php?".$QUERY_STRING."&action=get&file=6"); } } } $smarty->assign("main", "download"); $smarty->display("customer/home.tpl"); exit; } if (empty($id)) exit(); $chunk_size = 100*1024; # 100 Kb $query = "SELECT * FROM $sql_tbl[download_keys] WHERE download_key = '$id'"; $res = func_query_first($query); # If there is corresponding key in database and not expired if ((count($res) > 0) AND ($res['expires'] > time())) { # check if there is valid distribution for this product $productid = $res['productid']; # Change: changed variable names to use correct file distribution. $filedistribution = 'distribution'.$file; $result = func_query_first("SELECT $filedistribution, product, provider FROM $sql_tbl[products] WHERE productid = '$productid'"); $distributionfile = $result[$filedistribution]; $provider = $result['provider']; if (empty($provider) || $single_mode) $distribution = $files_dir_name.$distributionfile; else $distribution = $files_dir_name."/$provider".$distributionfile; if ($fd = @fopen($distribution, "rb")) { $fname = basename($distribution); $size = filesize($distribution); header("Content-type: application/force-download"); header("Content-Disposition: attachment; filename=\"$fname\""); header("Content-length: $size"); for($i=0; $i<=$size; $i+=$chunk_size) { $contents = fread ($fd, $chunk_size); echo $contents; } fclose ($fd); } else { # If no such distributive $smarty->assign("product", $result['product']); $smarty->display("modules/Egoods/no_distributive.tpl"); exit(); } } else { db_query("DELETE FROM $sql_tbl[download_keys] WHERE expires <= '".time()."'"); $smarty->display("modules/Egoods/wrong_key.tpl"); exit; }

--------------------------
include/product_modify.php
--------------------------

Code:
Code section: # # Update product data # # change: added distribution1 - distribution6 db_query("update $sql_tbl[products] set product='$product', categoryid='$categoryid', categoryid1='$categoryid1', categoryid2='$categoryid2', categoryid3='$categoryid3', brand='$brand', model='$model', descr='$descr', fulldescr='$fulldescr', avail='$avail', list_price='$list_price', weight='$weight', productcode='$productcode', forsale='$forsale', distribution1='$distribution1', distribution2='$distribution2', distribution3='$distribution3', distribution4='$distribution4', distribution5='$distribution5', distribution6='$distribution6', free_shipping='$free_shipping', shipping_freight='$shipping_freight', discount_avail='$discount_avail', min_amount='$min_amount', param00='$param00', param01='$param01', param02='$param02', param03='$param03', param04='$param04', param05='$param05', param06='$param06', param07='$param07', param08='$param08', param09='$param09', low_avail_limit='$low_avail_limit', $apply_vat free_tax='$free_tax' $apply_canadian_taxes where productid='$productid'");
----------------
include/func.php
----------------

Code:
Replaced all instances of 'distribution' with 'distribution1'

----------------------------
modules/egoods/send_keys.php
----------------------------

Code:
Replaced all instances of 'distribution' with 'distribution1'

----------------------------------
skin1/admin/main/product_links.tpl
----------------------------------

Code:
Replaced all instances of $product.distribution with $product.distribution1

-------------------------------
skin1/customer/main/buy_now.tpl
-------------------------------

Code:
Replaced $product.distribution with $product.distribution1

----------------------------
skin1/customer/main/cart.tpl
----------------------------

Code:
Replaced $products[product].distribution with $products[product].distribution1

-------------------------------
skin1/customer/main/product.tpl
-------------------------------

Code:
Replaced {if $product.distribution eq ""} with {if $product.distribution1 eq "" and $product.distribution2 eq "" and $product.distribution3 eq "" and $product.distribution4 eq "" and $product.distribution5 eq "" and $product.distribution6 eq ""}

-------------------------------
skin1/modules/egoods/egoods.tpl
-------------------------------

Code:
{* $Id: egoods.tpl,v 1.5 2002/10/17 13:54:57 zorg Exp $ *} {* changed: provider can now add up to six product files. *} <tr> <td colspan=2 valign=middle class=Text> Guidelines: Please try to keep filesizes reasonable by splitting your product into multiple files if necessary. This will reduce problems for dial-up customers getting disconnected while downloading your product. We suggest a maximum filesize of 5MB (30mins at 56kps) for each file. </td> </tr> <tr> <td valign=middle class=Text>Product File #1</td> <td valign="middle"> {include file=main/popup_files_js.tpl} <INPUT type=hidden name=distribution1_filename> <input type="text" name="distribution1" size="24" value="{ $product.distribution1 }"> <input type=button value="Browse..." onClick="popup_files('modifyform.distribution1_filename', 'modifyform.distribution1');"> </td> </tr> <tr> <td valign=middle class=Text>Product File #2</td> <td valign="middle"> <INPUT type=hidden name=distribution2_filename> <input type="text" name="distribution2" size="24" value="{ $product.distribution2 }"> <input type=button value="Browse..." onClick="popup_files('modifyform.distribution2_filename', 'modifyform.distribution2');"> </td> </tr><tr> <td valign=middle class=Text>Product File #3</td> <td valign="middle"> <INPUT type=hidden name=distribution3_filename> <input type="text" name="distribution3" size="24" value="{ $product.distribution3 }"> <input type=button value="Browse..." onClick="popup_files('modifyform.distribution3_filename', 'modifyform.distribution3');"> </td> </tr><tr> <td valign=middle class=Text>Product File #4</td> <td valign="middle"> <INPUT type=hidden name=distribution4_filename> <input type="text" name="distribution4" size="24" value="{ $product.distribution4 }"> <input type=button value="Browse..." onClick="popup_files('modifyform.distribution4_filename', 'modifyform.distribution4');"> </td> </tr><tr> <td valign=middle class=Text>Product File #5</td> <td valign="middle"> <INPUT type=hidden name=distribution5_filename> <input type="text" name="distribution5" size="24" value="{ $product.distribution5 }"> <input type=button value="Browse..." onClick="popup_files('modifyform.distribution5_filename', 'modifyform.distribution5');"> </td> </tr><tr> <td valign=middle class=Text>Product File #6</td> <td valign="middle"> <INPUT type=hidden name=distribution6_filename> <input type="text" name="distribution6" size="24" value="{ $product.distribution6 }"> <input type=button value="Browse..." onClick="popup_files('modifyform.distribution6_filename', 'modifyform.distribution6');"> </td> </tr>

I also removed code from the email templates for sending the download keys.

-----------------------------------
skin1/mail/egoods_download_keys.tpl
-----------------------------------

Code:
Removed: {$lng.lbl_filename}: {$products[prod_num].distribution_filename}

(You don't have to remove this, but I didn't want to list the filenames in
the email, just in case the provider needs to add a file to the product he
may have forgotten to add.)

----------------------------------------
skin1/mail/html/egoods_download_keys.tpl
----------------------------------------

Code:
Removed: <tr> <td></td> <td><tt>{$lng.lbl_filename}:</tt></td> <td></td> <td><tt>{$products[prod_num].distribution_filename}</tt></td> </tr>

Please let me know if there is anything that I may have missed.
I have run lots of tests on it and it works so far.

Best regards,

Steve Castle
__________________
Gold 4.0.18
Reply With Quote
  #12  
Old 11-22-2006, 06:31 AM
 
joomlashack joomlashack is offline
 

Member
  
Join Date: Jul 2006
Posts: 15
 

Default Re: Egoods: Multiple downloadable files for each product.

Quote:
Originally Posted by wjbrewer
I had this mod done by X-cart. They charged $125, but it has paid for itself already. It seemed pretty complicated. It took a couple of weeks of testing and tweaking for it to work correctly. They changed a lot of things to get it to work. Maybe that is why it is not standard, when it seems it should be. Why have variants if there is only one product to download?

lol, they did the same for us. They probably have a standard solution they charge custom rates for
__________________
4.0.18 gold
Joomla Templates and Custom Web Development
team[at]joomlashack.com
Reply With Quote
  #13  
Old 07-08-2010, 09:21 PM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Egoods: Multiple downloadable files for each product.

Any solution about 4.3 versions?
__________________
4.6.1 Platinum


Reply With Quote
  #14  
Old 07-10-2010, 07:12 PM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Egoods: Multiple downloadable files for each product.

Any solution about 4.3.x versions in Pro???

Waiting for someone to reply...
__________________
4.6.1 Platinum


Reply With Quote
  #15  
Old 07-11-2010, 01:09 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Egoods: Multiple downloadable files for each product.

http://www.bcsengineering.com/store/download-expander-for-x-cart.html
__________________
xcart 5.1.2
Reply With Quote
  #16  
Old 07-11-2010, 08:25 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Wink Re: Egoods: Multiple downloadable files for each product.


That is purchased mod!!! If it is completed mods please provide support in all versions.
__________________
4.6.1 Platinum


Reply With Quote
  #17  
Old 07-11-2010, 01:02 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Egoods: Multiple downloadable files for each product.

This is the only solution I know of.
__________________
xcart 5.1.2
Reply With Quote
  #18  
Old 07-12-2010, 02:31 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Egoods: Multiple downloadable files for each product.

Any other solution from anyone???
__________________
4.6.1 Platinum


Reply With Quote
  #19  
Old 07-12-2010, 06:51 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Egoods: Multiple downloadable files for each product.

it's either that or a custom mod, which will be way more than $99.

Ash
__________________
xcart 5.1.2
Reply With Quote
  #20  
Old 07-12-2010, 08:41 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Egoods: Multiple downloadable files for each product.

Ashley I want to say that it is completed mods and Steve Castle has done these for X-Cart Pro 3.5.3.I want to say is it possible to someone for 4.3 versions or Steve can help me!!!!

waiting for someone for 4.3.x versions...

Thanks to all.
__________________
4.6.1 Platinum


Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:15 AM.

   

 
X-Cart forums © 2001-2020