Product variant special case problem

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
pelliott67
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Thu Oct 09, 2008 4:53 pm

Product variant special case problem

Post by pelliott67 » Wed Oct 29, 2008 12:06 pm

Hi All,
We're setting up a store that sells videos. Customer needs to be able to choose to download either of two formats or have a DVD shipped to them. We've set this up so that each video is a product with 3 variants: format1, format2, and DVD. The first 2 variants have digital goods associated with them, and each variant has a SKU modifier. So far so good.

Here are the challenges:
1. Shipping. We want to expose the shipping options when customer chooses the DVD variant but not the downloadable variants. I haven't been able to figure out how to do this. Any hints?
2. Emails. a) We'd like to trigger email to the warehouse that'll ship the DVD when an order containing a DVD is paid, but not when the order contains only non-shippable variants. b) We'd like to trigger the 'your download is available' mail when a downloadable order is paid, but not when a shippable order is paid. (We're not requiring a serial key.) Again, I'm stumped on these.

Any help will be greatly appreciated!

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Product variant special case problem

Post by mazhar » Fri Oct 31, 2008 4:49 am

1. Shipping. We want to expose the shipping options when customer chooses the DVD variant but not the downloadable variants. I haven't been able to figure out how to do this. Any hints?
Well you can customize the BuyProductDialog to show the custom information when a variant that doesn't contain the digital good is selected. Below is a sample code that shows a message that product could be shipped.

Edit the ConLib/BuyProductDialog.ascx.cs file, locate following if statement in the Page_Init method

Code: Select all

if (_Product != null)
{
...............................
...............................
...............................
}
else
{
this.Controls.Clear();
}
and make it look like

Code: Select all

if (_Product != null)
{
...............................
...............................
 string optionList = ProductVariantDataSource.GetOptionList(_ProductId, _SelectedOptions, false);
            if (!String.IsNullOrEmpty(optionList))
            {
                bool isShipable = true;
                foreach (ProductDigitalGood digtalGood in _Product.DigitalGoods)
                {
                    if (digtalGood.OptionList == optionList)
                    {
                        isShipable = false;
                    }
                }
                if (isShipable)
                {
                    ShippingMessage.Text = "Shipable";
                    ShippingMessage.Visible = true;
                }
                else
                {
                    ShippingMessage.Visible = false;
                }
            }
            else
                ShippingMessage.Visible = false;
}
else
{
this.Controls.Clear();
}
Now edit the ConLib/BuyProductDialog.ascx file and locate the following line of code

Code: Select all

<tr>
                <td></td>
                <td>
                    <asp:PlaceHolder ID="InventoryDetailsPanel" runat="server" EnableViewState="false"></asp:PlaceHolder>
                </td>
            </tr>
and make it look like

Code: Select all

<tr runat="server" enableviewstate="false">
                <td colspan="2">
                    <asp:Label ID="ShippingMessage" runat="server" EnableViewState="false"></asp:Label>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <asp:PlaceHolder ID="InventoryDetailsPanel" runat="server" EnableViewState="false"></asp:PlaceHolder>
                </td>
            </tr>

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Product variant special case problem

Post by mazhar » Fri Oct 31, 2008 5:46 am

2. Emails. a) We'd like to trigger email to the warehouse that'll ship the DVD when an order containing a DVD is paid, but not when the order contains only non-shippable variants. b) We'd like to trigger the 'your download is available' mail when a downloadable order is paid, but not when a shippable order is paid. (We're not requiring a serial key.) Again, I'm stumped on these.
You can create your custom template and then create Email contents using the order information with NVelocity help. For example the below the code will send an Email with download message if the order item contains digital good.

Code: Select all

#foreach($orderItem in $order.Items)
#if($orderItem.OrderItemType == "Product")
#if($orderItem.Product.DigitalGoods.Count > 0)
Download Aavailable
#else
#end
#end
#end

pelliott67
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Thu Oct 09, 2008 4:53 pm

Re: Product variant special case problem

Post by pelliott67 » Mon Nov 10, 2008 5:10 pm

Thanks Mazhar! We'll give this a try.

pelliott67
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Thu Oct 09, 2008 4:53 pm

Re: Product variant special case problem

Post by pelliott67 » Mon Nov 10, 2008 5:47 pm

Mazhar, just looking at the proposed email solution I'm not sure it will work for the vendor notification case. It looks as though the proposed solution allows us to vary the message text based on the contents of the order; for ex. if order contains downloadable goods send this text, otherwise send this other text. That's fine for the customer (if order contains downloadable goods send 'your goods are ready for download', otherwise send 'thanks for shopping with us') but in the case of mail to the vendor we don't want to send anything at all if the order contains no shippable items. Is there a way to use the order information to specify whether or not the email gets generated at all?
Thanks again,
Paul

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Product variant special case problem

Post by mazhar » Tue Nov 11, 2008 7:39 am

For this scenario you can remove the trigger from VendorNotification template so that system will not send the Email automatically to the vendor. Then you can send that template manually to the vendors after checking that weather the order contains the shipment or not. For example you can put some code in RecieptPage that checks weather the current order contains some shipment or not. If the order contains shipment then load vendor notification template manually and send it to the vendor.

pelliott67
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Thu Oct 09, 2008 4:53 pm

Re: Product variant special case problem

Post by pelliott67 » Wed Nov 12, 2008 2:29 pm

Thank you again, Mazhar.

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: Product variant special case problem

Post by mfreeze » Tue Jun 01, 2010 10:34 am

Mazar,

I have a similar situation in 7.0.4. I have products with 2 shippable options (DVD and Cassette) and one that is not shippable (Download). What I need is to not only hide the shipping charge but to not charge shipping for the Digital Good (Download). The main product is marked shippable.

I tried this code but it did nothing. The shipping showed and shipping was charged. Any suggestions?

It would be really nice if shippable/nonshippable was an option on the variations.

Post Reply