Has anyone found a method to copy the items in a basket and leave the items in the old basket also?
Basket.Transfer deletes them from the first basket and in a situation where you are emailing a basket to a friend or friends, it works fine according a post from mazhar earlier, but we need to keep the contents of the original basket for the potentiality of another friend viewing it.
Copy a basket, but leave items in original basket
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Copy a basket, but leave items in original basket
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Copy a basket, but leave items in original basket
Have you tried making a new basket instance and doing Token.Instance.User.Baskets.Add(_NewBasket)?
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Copy a basket, but leave items in original basket
I'll look at that. I make a new basket, new user, access code in the code to send a basket email, then another new basket as a result of clicking the link in the email and going to the basket page.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Copy a basket, but leave items in original basket
I'm pretty sure baskets is another class just like all the others. You can make a new instance and .add(_new).
The question would be what Able considers "the basket" when the user has multiple baskets. Is it the most recently saved basket? Or is it the first basket?
The question would be what Able considers "the basket" when the user has multiple baskets. Is it the most recently saved basket? Or is it the first basket?
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
Re: Copy a basket, but leave items in original basket
Try to accomplish it as below, the key point is to call basket.Save before assigning any basket item to it. The reason is basket items are attached to basket depending upon basket it, so in order to put items in to new basket first you need to have a basket with new id.jmestep wrote:Has anyone found a method to copy the items in a basket and leave the items in the old basket also?
Basket.Transfer deletes them from the first basket and in a situation where you are emailing a basket to a friend or friends, it works fine according a post from mazhar earlier, but we need to keep the contents of the original basket for the potentiality of another friend viewing it.
Code: Select all
Basket basket = new Basket();
basket.UserId = Token.Instance.UserId;
basket.Save();
foreach (BasketItem bi in Token.Instance.User.Basket.Items)
basket.Items.Add(bi);
basket.Save();
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Copy a basket, but leave items in original basket
OK, I will try that. Thanks.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx