How to access image associated with Promo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to access image associated with Promo

Sanjeev Gupta
I want to access the Image content associated with a promotions in Ofbiz 11.04. I tried the functions ProductPromoContentWrapper.get("IMAGE")?if_exists but it gave me an error "Expression ProductPromoContentWrapper is undefined

Do you know what I'm doing wrong, an alternate method to access the image ?
Rgds
Sanjeev Gupta
www.digitalwebadvisors.com
Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

Ankush Upadhyay
Hello,

Try this <@renderImage contentId=productPromoContent.contentId?if_exists />
Here productPromoContent is Generic Record.
Yo can also Search this kind of pattern in ftl.

On 05/30/2012 08:57 AM, Sanjeev Gupta wrote:
> o you know what I'm doing wrong, an alternate method to access the image ?

--
Thanks&  Regards
Ankush Upadhyay
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

Sanjeev Gupta
Thanks. But I couldn't find anything on these lines in FTL files.

the sample code given also threw an error "InvalidReferenceException: "
Rgds
Sanjeev Gupta
www.digitalwebadvisors.com
Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

Ankush Upadhyay


Try this <img  
src="<@ofbizUrl>stream?contentId=${contentId}</@ofbizUrl>" alt="" />

On 05/30/2012 09:32 AM, Sanjeev Gupta wrote:

> Thanks. But I couldn't find anything on these lines in FTL files.
>
> the sample code given also threw an error "InvalidReferenceException: "
>
> -----
> Rgds
> Sanjeev
> www.sanjeevg.com
> @sanjeevgcom
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/How-to-access-image-associated-with-Promo-tp4632744p4632747.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

--
Thanks&  Regards
Ankush Upadhyay
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

chandan khandelwal-2
In reply to this post by Sanjeev Gupta
Hi Sanjeev,

You need to call makeProductPromoContentWrapper(GenericValue
productPromo, HttpServletRequest request) method of a  
ProductPromoContentWrapper class to define ProductPromoContentWrapper
then you can use ProductPromoContentWrapper to get product promo content
of a specific type.

HTH...

Thanks & Regards
--
Chandan Khandelwal
Sr. Enterprise Software Developer
HotWax Media Pvt. Ltd.

  On Wednesday 30 May 2012 08:57 AM, Sanjeev Gupta wrote:

> I want to access the Image content associated with a promotions in Ofbiz
> 11.04. I tried the functions
> *ProductPromoContentWrapper.get("IMAGE")?if_exists* but it gave me an error
> "*Expression ProductPromoContentWrapper is undefined*
>
> Do you know what I'm doing wrong, an alternate method to access the image ?
>
> -----
> Rgds
> Sanjeev
> www.sanjeevg.com
> @sanjeevgcom
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/How-to-access-image-associated-with-Promo-tp4632744.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>    

Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

Sanjeev Gupta
Hi Chandan,
I'm not sure how to do this in the FTL, can you please guide me..
Rgds
Sanjeev Gupta
www.digitalwebadvisors.com
Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

chandan khandelwal-2
Hi Sanjeev,

Please refer editShoppingList.ftl from ecommerce component

'<#assign productContentWrapper =
Static["org.ofbiz.product.product.ProductContentWrapper"].makeProductContentWrapper(product,
request)/>'

you need smiler kind of pattern for ProductPromoContent.

HTH.....

Thanks & Regards
--
Chandan Khandelwal
Sr. Enterprise Software Developer
HotWax Media Pvt. Ltd.


On Tuesday 05 June 2012 11:45 PM, Sanjeev Gupta wrote:

> Hi Chandan,
> I'm not sure how to do this in the FTL, can you please guide me..
>
> -----
> Rgds
> Sanjeev
> www.sanjeevg.com
> @sanjeevgcom
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/How-to-access-image-associated-with-Promo-tp4632744p4633261.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>    

Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

Mohd Viqar
Hi Sanjeev,

You can use this code in <ofbizDir>/applications/order/webapp/ordermgr/entry/cart/showAllPromotions.tfl to see all promotions with promotion images.

<div>
    ${uiLabelMap.OrderSpecialOffers}
    <div>
        <ul>
        <#-- show promotions text -->
        <#list productPromosAllShowable as productPromo>
        <#assign productPromoContentWrapper = Static["org.ofbiz.product.product.ProductPromoContentWrapper"].makeProductPromoContentWrapper(productPromo, request)/>
            <#assign imageUrl = Static["org.ofbiz.product.product.ProductPromoContentWrapper"].getProductPromoContentAsText(productPromo, "ORIGINAL_IMAGE_URL", request)?if_exists>
                <#if !imageUrl?string?has_content>
                  <#assign imageUrl = productPromoContentWrapper.get("ORIGINAL_IMAGE_URL")?if_exists>
                </#if>
                <#if !imageUrl?string?has_content>
                  <#assign imageUrl = "/images/defaultImage.jpg">
                </#if>
            <li><img src="<@ofbizContentUrl>${contentPathPrefix?if_exists}${imageUrl}</@ofbizContentUrl>" class='cssImgStandard' alt="" /></li>
            <li><a href="<@ofbizUrl>showPromotionDetails?productPromoId=${productPromo.productPromoId}</@ofbizUrl>" class="button">${uiLabelMap.CommonDetails}${StringUtil.wrapString(productPromo.promoText?if_exists)}</li>
        </#list>
        </ul>
    </div>
</div>

<#if (shoppingCartSize > 0)>
  ${screens.render(promoUseDetailsInlineScreen)}
</#if>

Regards
Mohd Viqar
Reply | Threaded
Open this post in threaded view
|

Re: How to access image associated with Promo

Sanjeev Gupta
Thanks Chandan, Viqar !!
Rgds
Sanjeev Gupta
www.digitalwebadvisors.com