Page 1 of 2

Adding item quantity in inventory

Posted: Wed Jun 25, 2014 6:47 am
by abhilash.ghosh
Hello Guys,

I am running demo site v3.1.3-GA. I have a small question. While adding the product in the "inventory tab" i found there are three options namely:

1. Always Available
2. Check inventory
3. Unavailable

if i choose "Check Inventory" option then the item is showing as "out of stock". Is there any way to set the "no of quantity" of an item from Admin panel?

Looking for your earliest response.

Thanks in advance

Re: Adding item quantity in inventory

Posted: Wed Jun 25, 2014 11:09 am
by phillipuniverse
The 'Check Inventory' option is designed to check the number that is set in the 'Quantity Available' field. Is something about this not working? Maybe there is a wrong check in the DemoSite code?

Re: Adding item quantity in inventory

Posted: Wed Jun 25, 2014 11:17 am
by abhilash.ghosh
phillipuniverse wrote:The 'Check Inventory' option is designed to check the number that is set in the 'Quantity Available' field. Is something about this not working? Maybe there is a wrong check in the DemoSite code?


Where is the "Quantity Available" field in the admin panel? I can't see that? Please find the attached image for more details.

It would be great if you can show me if i am wrong anywhere.

Re: Adding item quantity in inventory

Posted: Wed Jun 25, 2014 1:11 pm
by phillipuniverse
Ah, I see the confusion. The inventory management itself is not enabled out of the box in the 3.1 line; it will be enabled out of the box in 3.2.0-GA (not yet released). For notes in enabling this in your installation on 3.1 see http://www.broadleafcommerce.com/docs/c ... -migration.

Re: Adding item quantity in inventory

Posted: Wed Jun 25, 2014 1:12 pm
by phillipuniverse
You might also want to check out our inventory concepts page at http://www.broadleafcommerce.com/docs/c ... /inventory.

Re: Adding item quantity in inventory

Posted: Thu Jun 26, 2014 6:24 am
by abhilash.ghosh
phillipuniverse wrote:Ah, I see the confusion. The inventory management itself is not enabled out of the box in the 3.1 line; it will be enabled out of the box in 3.2.0-GA (not yet released). For notes in enabling this in your installation on 3.1 see http://www.broadleafcommerce.com/docs/c ... -migration.


Hi phillip,

Thanks for the links.

I am using Demo site v3.1.3. I could see that all the changes are already implemented in that version. Still, I can't see that "Quantity Available" option from Admin panel. However, in documentation (http://www.broadleafcommerce.com/docs/c ... /inventory) you can see the screenshot shows the "Quantity Available" option.

Could you please tell me what is wrong?

Re: Adding item quantity in inventory

Posted: Thu Jun 26, 2014 9:28 am
by abhilash.ghosh
Hi Phillip,

Any idea about the below mentioned error:

SkuImpl - Inventory was attempted to be invoked on a Sku, but there is no byte code weaving hooked up in order to determine the correct quantity available. If you would like to enable the quantity enable field, hook up the quantityAvailable field via the QuantityAvailableSkuTemplate or override the getQuantityAvailable() method in a SkuImpl subclass. Returning null to indicate that quantity available is unset


I can see in the "org.broadleafcommerce.core.catalog.domain" package, there is a file named as "QuantityAvailableSkuTemplate.java" which contain the following code:

Code: Select all

@Embeddable
public class QuantityAvailableSkuTemplate {

    @Column(name = "QUANTITY_AVAILABLE")
    @AdminPresentation(friendlyName = "SkuImpl_Sku_QuantityAvailable",
            order = 1010,
            tab = ProductImpl.Presentation.Tab.Name.Inventory,
            tabOrder = ProductImpl.Presentation.Tab.Order.Inventory,
            group = ProductImpl.Presentation.Group.Name.Inventory,
            groupOrder = ProductImpl.Presentation.Group.Order.Inventory)
    protected Integer quantityAvailable = 0;

    public Integer getQuantityAvailable() {
        return quantityAvailable;
    }
   
    public void setQuantityAvailable(Integer quantityAvailable) {
        this.quantityAvailable = quantityAvailable;
    }
   
}


Do i need to change anything here?

Re: Adding item quantity in inventory

Posted: Thu Jun 26, 2014 11:08 am
by phillipuniverse
Yes, you need to follow all the instructions on the migration notes that I linked regarding inventory. The first item talks about how to hook up the QuantityAvailableSkuTemplate:

Code: Select all

<!-- Inventory class transformer to enable simple inventory management. This transformer should be removed in Broadleaf 3.2.0+ -->
<bean id="blInventoryClassTransformer" class="org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyClassTransformer">
    <constructor-arg name="moduleName" value="Basic Inventory Management" />
    <property name="xformTemplates">
        <map>
            <entry key="org.broadleafcommerce.core.catalog.domain.SkuImpl"
                   value="org.broadleafcommerce.core.catalog.domain.QuantityAvailableSkuTemplate">
            </entry>
        </map>
    </property>
</bean>

<bean id="customClassTransformers" class="org.springframework.beans.factory.config.ListFactoryBean">
    <property name="sourceList">
        <list>
            <ref bean="blInventoryClassTransformer" />
        </list>
    </property>
</bean>

<bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor">
    <property name="collectionRef" value="customClassTransformers" />
    <property name="targetRef" value="blMergedClassTransformers" />
</bean>


You will also need to hook up Spring instrument in order to properly weave that class in: http://www.broadleafcommerce.com/docs/c ... me-weaving

Re: Adding item quantity in inventory

Posted: Thu Jun 26, 2014 12:24 pm
by abhilash.ghosh
phillipuniverse wrote:Yes, you need to follow all the instructions on the migration notes that I linked regarding inventory. The first item talks about how to hook up the QuantityAvailableSkuTemplate:

Code: Select all

<!-- Inventory class transformer to enable simple inventory management. This transformer should be removed in Broadleaf 3.2.0+ -->
<bean id="blInventoryClassTransformer" class="org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyClassTransformer">
    <constructor-arg name="moduleName" value="Basic Inventory Management" />
    <property name="xformTemplates">
        <map>
            <entry key="org.broadleafcommerce.core.catalog.domain.SkuImpl"
                   value="org.broadleafcommerce.core.catalog.domain.QuantityAvailableSkuTemplate">
            </entry>
        </map>
    </property>
</bean>

<bean id="customClassTransformers" class="org.springframework.beans.factory.config.ListFactoryBean">
    <property name="sourceList">
        <list>
            <ref bean="blInventoryClassTransformer" />
        </list>
    </property>
</bean>

<bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor">
    <property name="collectionRef" value="customClassTransformers" />
    <property name="targetRef" value="blMergedClassTransformers" />
</bean>


You will also need to hook up Spring instrument in order to properly weave that class in: http://www.broadleafcommerce.com/docs/c ... me-weaving



Thanks! it worked.

Re: Adding item quantity in inventory

Posted: Wed Jul 09, 2014 1:52 pm
by meifullerton
Hi,
I followed these instructions, but the quantity field is still not showing up in the admin. Any ideas?

Thanks,
Mei