hi i used com.konakart.app.DataDescConstants.ORDER_BY_PRICE_ASCENDING but i am not getting products sorted by price .Please help me to resolve this problem
package org.argus.konakart;
import org.medicalert.website.idm.entities.Product;
import com.konakart.app.DataDescriptor;
import com.konakart.app.ProductSearch;
import com.konakart.appif.ProductIf;
import com.konakart.appif.ProductSearchIf;
import com.konakart.appif.ProductsIf;
public class sort_Byprice extends BaseApiExample
{
public static void main(String[] args)
{
try
{
init();
int i;
ProductsIf output;
ProductIf data[];
DataDescriptor dataDesc = new DataDescriptor();
//DataDescriptorIf dataDesc = new DataDescriptorIf();
dataDesc.setOffset(0);
dataDesc.setLimit(50);
dataDesc.setOrderBy_1(com.konakart.app.DataDescConstants.ORDER_BY_PRICE_DESCENDING);
//dataDesc.setOrderBy_1(com.konakart.app.DataDescConstants.ORDER_BY_NAME_ASCENDING );
output=eng.getAllProducts(sessionId,dataDesc,-1);
data=output.getProductArray();
System.out.println("\n\n\n\n\n\n\n\n\n");
System.out.println("=====Total no of product is : "+output.getTotalNumProducts()+" ===========");
//output.getTotalNumProducts()
for(i=0;i<output.getTotalNumProducts();i++)
{
System.out.println("Product name is ::" +data.getPriceExTax());
}
}
catch(Exception e)
{
System.out.println("The exception is ::" +e);
}
}
}
::::::output:::::
=====Total no of product is : 13 ===========
Product price is ::299.9900
Product price is ::499.9999
Product price is ::29.9900
Product price is ::32.0000
Product price is ::54.9900
Product price is ::79.9900
Product price is ::89.9900
Product price is ::99.9900
Product price is ::123.0000
Product price is ::100.0000
Product price is ::113.0000
Product price is ::311.0000
Product price is ::500.0000
Use setOrderBy() for the frst sortBy and setOrderBy_1() for the second sortBy. If you just want price, then use setOrderBy() and not setOrderBy_1() .
ya i solved this