Hi,

I added two basic field field formatters to make it easier to implement this module in D7. These should work on the node page and in views.

Zipcart Basic Link
Zipcar Table of Files

Formatters

In addition I added functionality to remove an item from the cart by clicking the zipcart link again. I also updated the jQuery to make this functionality more obvious. It still needs some work but here it is if anyone is interested in taking a look. I'll likely improve this a bit more this week when I get some time.

*Known issue, the counter doesn't seem to be updating sometimes when an item is removed.

-Time

Comments

Haiping’s picture

Hi,
The patch works great, and I fixed the "counter issue", just change the two line code "unset($_SESSION['zipcart']['files'][$path_key]);" to "array_splice($_SESSION['zipcart']['files'], $path_key, 1);" located in function zipcart_remove_file_to_cart;

function zipcart_remove_file_to_cart($ajax = FALSE) { 
   /*
    * Fix counter issue 
    * Known issue, the counter doesn't seem to be updating sometimes when an item is removed.    
    */
  //unset($_SESSION['zipcart']['files'][$path_key]);
  array_splice($_SESSION['zipcart']['files'], $path_key, 1);
}
xurizaemon’s picture

Thanks TimeFor, appreciated. This doesn't apply currently.

If you reroll this please include Haiping's amendment above, omit the fix for #1085652: Drupal filepath in JS incorrect if Drupal not installed to site root and .info changes, and check any whitespace changes against coding standards?

"zipcart_remove_file_to_cart" should be "zipcart_remove_file_from_cart" also.

timefor’s picture

I got back around to updating this. This was taken off the current 7.x-1.x-dev. It adds field formatters for files and images plus it provides the ability to click the download basket link again to remove the file. I included the file count fix from above.

m.zerres’s picture

How your zipcart-block-downloads.tpl.php look like, to print the output this way? Thanks!

timefor’s picture

The zipcart-block-downloads.tpl.php is only for the My Downloads block. It doesn't format the "add to basket" links. I did not change the template at all.

-Time

timefor’s picture

I'm back working on this module again and I've made a few improvements since my last posted patch. I think these might be general enough improvements that might benefit others.

I've added a number of fixes and re-rolled patches from that lastest 7.x-1.x-dev

Zipcart Updates

  • Add / Remove Icons next to Basket Links
  • New loading animation when Basket Links are clicked
  • Commented out the original animation as it conflicted on some browsers
  • Reutrn destination in links now shows paths alias instead of just node/nid
  • Major change: zipcart now uses a filename parameter (?filename=name.ext) to pass in the file instead of the filename in the whole path
  • Major change: added confirmation to zipcat download block
    • Designed to solve some UX problems with the original design
    • If cart is empty, explains what the Download Basket is and shows an example basket link
    • If cart has items, asks if user wishes to download or continue adding items
    • Once begin download is selected, number of items in the cart and basket links on page are reset without page refresh

Since there was so much happening I did this in 4 commits and ended up with 4 patches. Sorry.

- Time

xurizaemon’s picture

Looks awesome TimeFor, thanks for working on this.

As you say, there's a lot happening there. It's easier for this maintainer to assess four issues and four patches than one which lumps them all together. Happy to look at this if you supply a patch for this issue (#1579282: D7: Added Remove Item from Cart / File Field Formatters) here, and add other changes as patches to separate issues.

oakulm’s picture

Hi

Could you please add example on how to use theme() after applying your patches ? I think this changes the default behaviour so much that documentation would be great

oakulm’s picture

Status: Needs work » Needs review

Ok just to clarify for everyone after havin used many hours on this.

Drupal 7 zipcart theme after these patches is :

theme('zipcart_download', array('text' => t('your link text'), 'path' => '', 'options' => array('query' =>  array('file' => $item['uri']) ))); ?>

So it's not "filename" it's "file"

fernando vesga’s picture

Hi,

i'm using this module in this way.

I build a view, and i add a global custom text field which i output as a link with this path:

/zipcart/add/sites/default/files/[field_media_image_1]?destination=media-library (media-library is my images page)
[field_media_image_1] is the image to download, after the patches, it works fine

but once i applied all these patch, no images were added to the basket, so i think my path is no working any more.

Why? I think i'm missing something

thanks

simonbcfa’s picture

StatusFileSize
new24.25 KB

Possibly a silly question, how do i get this page to show up? (see image, same as above)

I have created a view and added the filenames (as links) with the class and prefix, so when clicked it is added to the downloads block,

I have added the patches, and l would like to be able to see each download with the option to add and delete files

broon’s picture

Issue summary: View changes

Hey, how is the current status of this project?
Last dev release is from 2013 and last issue queue action was more than 7 months ago. I stumbled upon this module as it has the basic functionality of what my client is looking for but I would need to make major changes to meet my clients needs. As this might be an appreciated development for this module (2.x maybe?), I am asking for the status and also if co-maintainers would be accepted.

Changes I would want to incorporate are (1) this thread's field handlers, (2) checkboxes instead of links to add/remove files to basket, (3) designated page to view current basket's content (and modify content) as well as (4) an extended admin interface to allow for more features and settings (e.g. remove links to original file, set a name for the basket like "portfolio" or "info brochure" including translation settings.
Also, I'd like to collect file ids (fid) instead of paths and eventually create entities out of collections for later reuse by other users.

xurizaemon’s picture

@Paul, I'm happy to consider contributions and co-maintainers based on quality contributions.

Project status is: I created this project for a specific client a while back, and am not currently using the functionality myself. I'm not opposed to this functionality, think I just didn't have time to review all the changes it introduced.

Please do use consider using this module as a starting point, and I'll do my best to help get improvements committed.

broon’s picture

Patches have been provided quite some time ago, I have been using my "ZipCart 2" module in production for more than 8 month now and consider it to be stable.
See my comment in my main extension issue thread to learn more about DocBinder, my successor module of ZipCart (basically it's ZipCart 7.x-2.x).