ability to go into subalbums (for slideshow / add to cart)

ziddey

Joined: 2004-11-01
Posts: 52
Posted: Thu, 2004-12-09 23:25

Hi. In the current g2 (as well as g1), I see that we can create subalbums, but if say I have a primary album under my username and have all subalbums, but want to slideshow or add to cart everything of mine, I can't do that, since it doesn't include subalbums in it.

But I only have about 10 pics in each subalbum, and when I show my pictures in a slideshow (or add to cart to download for someone), I'd like to have it be able to do them all.

Would something like this be a fair suggestion? If so, consider it suggested ;)

Anyone agree? Or am I insane?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-12-10 00:23

the underlying code for slideshow supports building a recursive slideshow, but there is no UI for it. feel free to add a feature request on sourceforge.. thanks!

(since we may not do this soon, you can make it always recursive on your site simply by changing $recursive = false to $recursive = true in your modules/slideshow/Slideshow.inc file)

 
igrcic
igrcic's picture

Joined: 2005-04-19
Posts: 78
Posted: Sat, 2005-06-25 09:00

And what about recursive Add to cart?
Is it possible to add to cart all subalbums images? Few of my users complained that Add to cart option doesnt work. Off course that it works but they have to be in albums with images, not subalbums.

Didn't find anything similar to $recursive variable in cart module.

 
igrcic
igrcic's picture

Joined: 2005-04-19
Posts: 78
Posted: Sun, 2005-07-03 13:04

solutions for this problem? please anyone?

 
mhedstrom

Joined: 2003-04-25
Posts: 7
Posted: Mon, 2006-01-02 03:42

Any progress on this? This thread is over a year old, was wondering if there was something built in that I've missed in order to fix the "add to cart" option with subalbums.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-01-02 04:28

nope, noone has edited the slideshow module yet to do that.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-01-02 06:09

in fact, no one has worked on slideshow module in like a year and a half.. that continues to amaze me.

 
alzone

Joined: 2006-11-02
Posts: 3
Posted: Wed, 2006-12-13 01:12

I see this is a very old thread but I wonder if there is now an answer/solution to the Add to Cart recursive query. I would like my clients to be able to Add to Cart at an upper enclosing Album level and get all sub-Albums and images.

 
Aosh

Joined: 2007-04-20
Posts: 14
Posted: Wed, 2007-05-16 18:08

i noticed this problem and wrote a quick fix for it a few weeks ago
it's just a recursive add -i'll post it later

i'm surprised no1 addressed this earlier!!

 
alzone

Joined: 2006-11-02
Posts: 3
Posted: Wed, 2007-05-16 21:14

Hi Aosh,

Yes! Please post your fix. I would desparately like to have this problem fixed. I myself have no real ability with code but have a staff member that I'm sure could implement your fix.

Cheers

 
Aosh

Joined: 2007-04-20
Posts: 14
Posted: Thu, 2007-05-17 23:29

Okay, before I forget here it is. This "bug" has nothing to do with Zip Cart -even if you don't install the zipcart module, you'll notice that adding to your cart is not recursive.
The fix must go in the Cart module. 2 files need to be edited.

/modules/cart/classes/CartHelper.class

Define the following function anywhere in the class:

/* Recursive function that drills down to get every single child id*/
function fetchAllChildDataItemIds(&$item) {
    if (!$item->getCanContainChildren()) {  // base step, return myself
        return array($item->getId());
    } else {
        list ($ret, $childrenIds) = GalleryCoreApi::fetchChildItemIds($item);
        if ($ret) {
            return null;
        }

        list ($ret, $childrenItems) = GalleryCoreApi::loadEntitiesById($childrenIds);
        if ($ret) {
            return null;
        }

        $return_array = array();
        foreach ($childrenItems as $childItem) {
            $array_to_add = CartHelper::fetchAllChildDataItemIds($childItem);
            $return_array = array_merge($return_array, $array_to_add);
        }

        return $return_array;
    }
}

And in /modules/cart/AddToCart.inc around line 45-47, change:

(may be slightly different depending on which revision you're using)

/* Figure out what ids we care about */
if ($item->getCanContainChildren()) {
    list ($ret, $ids) = GalleryCoreApi::fetchChildDataItemIds($item);

to:

/* Figure out what ids we care about */
if ($item->getCanContainChildren()) {
    $ids = CartHelper::fetchAllChildDataItemIds($item);

NOTE:

This has NOT been extensively tested -I was mostly annoyed at the functionality and decided to fix it in 10 minutes. I'm not using this module anymore but I plan to return to it in the future to make it more robust. However, I've poked at it and it seems to work fine (even with mixed jpg, mov, avi). The only bug I ran into was trying to add the root album to the cart -I didn't bother debugging it though. If you run into any problems, please let me know and I'll be happy to look into it.

 
Aosh

Joined: 2007-04-20
Posts: 14
Posted: Thu, 2007-05-17 06:07

er, I see that it escaped some of my text.
every time you see -> replace that with ->
every time you see & replace that with &

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2007-05-17 12:11

use the code instead of the php tag. then it won't convert < > to &gt; / &lt;

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage