• Welcome to KonaKart Community Forum. Please login or sign up.
 

Problem using catalog prices

Started by pampin, January 28, 2015, 12:49:43 pm

Previous topic - Next topic

pampin

Hi folks,

we are trying to add a product with the prices of a catalog to the cart (konakart v7.3.0.1); we have this code:

      public int addOneToBasketWithCatalog(final int customerId, final int productId, final String catalogId) throws KKException {
             FetchProductOptionsIf productOptions = new FetchProductOptions();
             productOptions.setCatalogId(catalogId);
             productOptions.setUseExternalPrice(Boolean.TRUE);
             ProductIf product = this.engine.getProductWithOptions(null, productId, KKConstants.DEFAULT_LANGUAGE_ID, productOptions);
             
             if (product != null) {
                    BasketIf basket = new Basket();
                    basket.setQuantity(1);
                    basket.setProduct(product);
       
                    final AddToBasketOptionsIf addToBasketOptions = new AddToBasketOptions();
                    addToBasketOptions.setAllowMultipleEntriesForSameProduct(Boolean.TRUE);
                    addToBasketOptions.setCatalogId(catalogId);
                    addToBasketOptions.setUseExternalPrice(Boolean.TRUE);
                   
                    return this.engine.addToBasketWithOptions(null, customerId, basket, addToBasketOptions);
             }
             return 0;
       }





The engine finds the product successfully but when it runs the "addToBasketWithOptions" method, it throws this exception:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.rmi.RemoteException: Product referenced by id = 0 doesn't exist.; nested exception is:
       com.konakart.app.KKException: Product referenced by id = 0 doesn't exist.
faultActor:
faultNode:
faultDetail:
       {http://xml.apache.org/axis/}hostname:webecommerpre01

java.rmi.RemoteException: Product referenced by id = 0 doesn't exist.; nested exception is:
       com.konakart.app.KKException: Product referenced by id = 0 doesn't exist.
       at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
       at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
       at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
       at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
       at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
       at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
       at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
       at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
       at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
       at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
       at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332)
       at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
       at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
       at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
       at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
       at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)





maybe this is a bug or am I doing something wrong...?


AddToBasketOptionsIf JavaDoc : http://www.konakart.com/javadoc/server/com/konakart/appif/KKEngIf.html#addToBasketWithOptions(java.lang.String, int, com.konakart.appif.BasketIf, com.konakart.appif.AddToBasketOptionsIf)


thanks in advance
PampĂ­n

julie

You need to set the productId attribute on the basket object.

I think your company has a support contract. If that is the case, you'll get better support by writing to support@konakart.com .

pampin

Hi julie, thanks for responding so quickly.

I have setted the productId to the basket but then, KK doesn't use the "basket.product" property, ignoring the catalog prices, since the "addToBasketOptions.setCatalogId(catalogId);" method is ignored also.

The Javadoc says that we only have to set the "basket.productId" if the "basket.product" is not setted:

The Basket object does not have to be fully populated. The compulsory attributes are:

- productId only if the product attribute is set to null
- quantity
- opts only if there are selected options


We doesn't have support contract, but I think that maybe this is a bug...


julie

If you set a product object, it won't look up a new one and should use the prices in the one you passed in.

pampin

That's the problem, that it doesn't use the prices in the one I passed in (nor the "basket.product.productId" property)...

julie

I find that hard to believe since many of our customers use catalog prices. If you pass in a product object it will use the priceExTax of that object unless you have a special price or tiered prices.