Post by wamfgcom » Sun Jul 16, 2017 4:17 am

Hope I'm in the right section for this ;)

My problem is simply one of aesthetics, I am offering digital downloads in several file formats. For each purchase customers will have the availability of six (6) different file extensions; epub, mobi, pdf etc. That mean if someone purchases 6 items their download list will consist of 36 items, which could be a bit confusing as each download "stacks" one upon the other.
What I was hoping to do would be grouping each download by "ID" in it's own separate "block" (Table).

In the account/download.tpl it currently calls for "foreach ($downloads as $download)" and then it sets out the table structure.
I'm hoping to find a way to call for each download by "ID" so that the end result would be a separate table structure for each "ID".

I comfortable creating/adjusting the table structures, just not sure how (or if it's possible) to call by ID.
Any thoughts would be appreciated :)
v 2.3.0.2

Newbie

Posts

Joined
Sat Oct 09, 2010 4:05 am

Post by artcore » Sun Jul 16, 2017 4:43 am

Hi,
If bundling them in one zip won't do you could create an array from all the downloads where the keys are the product_id and the downloads an array on each product_id
Now it's a matter of looping and create a new table when a new product_id is coming up; the rows being the downloads on that key.
Hope it makes sense :)

fake code idea:
$bundles = [];
foreach downloads as download
$bundles[download['product_id'] = download;

unset downloads,download
foreach bundles as product=>downloads
<table>
foreach downloads as download
<tr>
<td>echo download['???']
<td>...

User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by wamfgcom » Sun Jul 16, 2017 6:22 am

Appreciate the response

Zipping the files together isn't an option as the files are fair sized and theoretically the customer will only need one of them. The idea is of offering options for compatibility with various devices but I don't want them to have to choose prior to purchase so if there is a problem of compatibility they'd have ten days to come back and download a different version.

I believe your idea will answer my needs,
but as php isn't my native language I'm still a little lost ;(
Can anyone refine this for me?

Newbie

Posts

Joined
Sat Oct 09, 2010 4:05 am

Post by artcore » Sun Jul 16, 2017 3:16 pm

I understand the need, I happen to be an ebook creator as well.
What's your oc version and what do you want to group on? product or order?

User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by wamfgcom » Mon Jul 17, 2017 2:38 am

Hello and thank you for the interest in my problem,
I'm using oc v 2.3.0.2
Must admit your question had me thinking ;)
Likely "product" would be the way to go as I have the six file extensions listed under "downloads" in the product listing under the one common name.

Newbie

Posts

Joined
Sat Oct 09, 2010 4:05 am

Post by artcore » Mon Jul 17, 2017 4:49 am

Yes no problem, I'll create a little ocmod tomorrow

User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by wamfgcom » Mon Jul 17, 2017 5:59 am

Thrilled :o Thank you!

Newbie

Posts

Joined
Sat Oct 09, 2010 4:05 am

Post by artcore » Mon Jul 17, 2017 5:26 pm

Here you go.
Not extensively tested as I don't have too many orders with downloads on my demo. Let me know if all works out.

Group Downloads
Displays a table for all downloads attached to the product(s) in an order.
Change product_id to order_id to group on orders. Find below line in the ocmod.xml to do just that

<add position="replace"><!--[CDATA[$data['downloads'][$result['product_id']][] = array(]]--></add>

Attachments


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by wamfgcom » Tue Jul 18, 2017 9:43 am

Installed successfully ;) and I believe it will do the trick but I need to add some more product to test properly as well, and life calls :( will let you know how it goes soon as I can.
Thanks!

Newbie

Posts

Joined
Sat Oct 09, 2010 4:05 am

Post by wamfgcom » Fri Aug 11, 2017 9:12 am

Apologies!
Just after you provided that mod and I installed it then realizing I needed more products to test it properly...
unexpected house guests knocked on the door and stayed for two weeks.

I have just now properly tested it and it works great!
With 7 download options for each product it will help to clean up the very long "downloads" list created by buying multiple products.
Many Thanks!!!

Newbie

Posts

Joined
Sat Oct 09, 2010 4:05 am

Post by artcore » Fri Aug 11, 2017 1:52 pm

You're welcome wam, and thanks for the report back!
Cheers

User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands
Who is online

Users browsing this forum: deovalle and 13 guests