Page 2 of 2

Re: Adding item quantity in inventory

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

Thanks,
Mei


Please check your broadleaf version and also verify that spring instrument jar is present in the class path? Are you running the demo site from any IDE. If yes then you need to configure the spring instrument jar in your application server runtime parameters

Re: Adding item quantity in inventory

Posted: Wed Jul 09, 2014 8:39 pm
by meifullerton
Hi,
I'm running 3.1.4 GA. I do have spring instrument in the Tomcat classpath. I tried to run it in standalone tomcat (7.0.54) and within Eclipse, neither worked.

I guess do I need to change some template page in Admin to add the quantity field?

thanks,
Mei

Re: Adding item quantity in inventory

Posted: Thu Jul 10, 2014 1:19 am
by phillipuniverse
@meifullerton - the referenced XML configuration must be in the core package so both the 'site' project as well as the 'admin' project can benefit from it. Again, the copied config:

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>


Things I would check:

1. That snippet is in core/src/main/resources/applicationContext.xml
2. You have done a full rebuild to re-compile and re-jar the core project and not just the admin project

Those are the only reasons that I can think of that that configuration is not working for you.

Re: Adding item quantity in inventory

Posted: Thu Jul 10, 2014 4:18 am
by abhilash.ghosh
could you please check your tomcat environment variables in eclipse. Please go to "servers" panel and then double click on Tomcat Server then click on "open launch configuration". Once done, go to "Environment" tab and set the below mentioned property:

Code: Select all

CATALINA_OPTS(Varibale Name)
-Xmx1024m -javaagent:/usr/local/apache-tomcat-6.0.41/lib/spring-instrument-4.0.5.RELEASE.jar (value)


Please dont forget to change the spring-instrument jar path as per your location.

Restart the server. Hopefully, it should work.

Re: Adding item quantity in inventory

Posted: Thu Jul 10, 2014 11:33 am
by phillipuniverse
Yeah good point @abhilash.ghosh - Spring instrument needs to be registered as a Java agent, which means that it should be passed as a parameter to the JVM startup, not just in Tomcat's classpath.

Re: Adding item quantity in inventory

Posted: Thu Jul 10, 2014 3:18 pm
by meifullerton
Thank you abhilash.ghosh and phillipuniverse.

It's working now, the only difference is rebuilding site war as well as admin war file.

I didn't put Spring instrument as javaagent, only in the classpath and it seems to be okay.

Thanks again.
Mei