Hi,
I need to add a shopping cart for files, a file cart.
After files have been added and submited a package should be created temporary and forced to download.
I’ve wrote the Script for the cart with JavaScript and PHP from the values of [file_list] with the following script:
function generateCart(data){
if( typeof data == “string” ){
data = JSON.parse(data);
}
if( data.noItm != “undefined” && data.noItm != undefined){
var mk = “<p>” + data.noItm + “</p>”;
return mk;
}
var items = [“
\n”);
return items.join(“”);
}
$(document).ready(function(){
var TPL_DIR = “”;
var SCRIPT_URL = “download_cart.php”;
//Get table structure of wpdm-pro
var table = $(“.wpdm-filelist”);
var lth = table.children(“tbody”).children(“tr”).first().append(“<th>Aktionen</th>”);
var tableItems = table.children(“tbody”).children(“tr”).not(“:first-child”);
//Add ‘add to cart’ links
tableItems.children(“td:nth-child(2)”).children(“a”).each(function(){
var t = $(this);
var link = t.attr(“href”);
var name = t.parents(“tr”).children(“td”).first().text();
var args = link.slice(link.indexOf(“?”)+1);
args += “&name=” + name;
var markup = “<td class=’action’>In den Downloadkorb</td>”;
t.parents(“tr”).append(markup);
});
//Add download cart markup to sidebar
var mk = [‘<div id=”download-cart”>\n\t<p>Aktuell im Downloadkorb</p>’,
‘<div id=”cart-items”></div></div>’].join(“”);
$(“#sidebar”).html(mk);
/*** AJAX CALLS ***/
//Send AJAX request to get download cart on start
$.ajax({
//AJX REQUEST HERE
});
//Add items on click to cart ad update current cart.
$(“.action”).on(“click”, “a”, function(e){
//AJX REQUEST HERE
});
//Remove item from cart.
$(document).on(“click”, “.remove-itm”, function(e){
//AJX REQUEST HERE
});
}); //DOCUMENT READY END
In the cart (Session) the name, wpdml and ind arguments are saved.
So how can I now acces these files and pack them.
The packing would not be the problem as I can read the class.pack code but I dont know what do do with these
wpdml and ind arguments an how to acces the files through them.
Hi,
When selecting the browse tab, the window is blank with no options. The directory url is set in the settings. Even when I manually add the directory nothing happens. Please help.
thank you
Hello, I have a package that requires the email to get access to download button. Since wordpress 3.9.2 it seems the final page after the submission of email address returns an error all I got now is : {“error”:”<div class=\”alert alert-success\”>Download link sent to your email!<\/div>”,”downloadurl”:””}