PDA

View Full Version : RefineBy function code help.


sudheerk
21-11-08, 12:20
Hi everyone I am new to this forum, but not to coding.

I am in need of help on refineBy in version 2. I am unable to understand the ps-client class. what does an iId and sId refer to in that class object definition.

Which one is for category and which one for merchant.

The problem here is ,some merchant ids display the refineby values , and some throw a soap error. why does this happen?

I request for some assistance in this regard. Would be thankful if they can provide me with some code or hints in that regard.:)

Thanks in advance.

newidea
21-11-08, 19:41
Hi Sudheerk,

Could you pls explain what you are trying to do in more detail and I might be able to help? 'iId' is probably looking for a Integer value and 'sId' is looking for a string

morsborn
21-11-08, 19:58
Hi,

I was about to post a thread and saw this. I'm not sure if my problem is the same so thought I'd add to this one, if not please tell me and I will create a new one.

I have been trying to create a product list based on a specific category that I want to define in the code. Despite following the examples in the pdf's I just cannot get it to work. The line I beleive causing the error in question is in the producy_display_list.php file

# Get the products
$aProducts = $oShopCore->oApiProductList->getProductList($oProductDisplayListParams);

I want to set the refine by category and used the following code from the example ps_client.php replacing $oProductDisplayListParams with $aParams7 to override the variables.

/ Example refine by structure
// Refine by Merchant (3)
$oRefineBy = new stdClass();
$oRefineBy->iId = 3;
$oRefineBy->sName = '';

// Refine by merchant 1599
$oRefineByDefinition = new stdClass();
$oRefineByDefinition->sId = '1599';
$oRefineByDefinition->sName = '';
$oRefineBy->oRefineByDefinition = $oRefineByDefinition;

$aParams7 = array("sQuery" => "", "bAdult" => false, "iLimit"=>10, "oActiveRefineByGroup" => $oRefineBy);

$aProducts = $oShopCore->oApiProductList->getProductList($aParams7);

When I run this code it makes no difference. I turned debug mode on and the
refine by variable is null. Are there missing parameters when getProductList is called? Which ones are mandatory and is this not working because some global variable is overriding my settings?

When I looked at the api code (class.api_product_list.php) one of the sanity to checks at the start is to set aActiveRefineByGroups as below

$this->aActiveRefineByGroups = is_array($oParams->aActiveRefineByGroups) ? $oParams->aActiveRefineByGroups : $this->aActiveRefineByGroups;

I am pretty new to PHP so may be missing something fundamental but why did the example show to set a refine by object then a refine by definition to be passed but then in the function that is called check if it is an array?

Please can someone help me understand why this doesn't work????

cheers

newidea
22-11-08, 22:40
Hi,

As with most posts on this forum, when someone genuinely needs some assistance, the people who can help disappear. If Affiliate Window want Shop Window to be a real success, then I would suggest the following:

a. the documentation and code examples need to be improved. The examples in the documentation do not work as expected and the lack of details and supporting information is shocking
b. they should nuture a forum where ideas and problems can be shared openly and genuine answers and/or pointers can be given. I do not think members should provide pages and pages of code for answers but at least respond when someone asks for help....

Adrian
02-12-08, 17:38
Hi Mark,

Just spoke to a developer to look into the problem you're having...

The problem is that you are requesting a specific merchant and NOT a specific category.

The refine by needs to use iId of 4 and a valid category id.

For example:
{{{
// Refine by Category(4)
$oRefineBy = new stdClass();
$oRefineBy->iId = 4;
$oRefineBy->sName = 'Category';

// Refine by Category 246 (Sports)
$oRefineByDefinition = new stdClass();
$oRefineByDefinition->sId = '246';
$oRefineByDefinition->sName = 'Sports'; $oRefineBy->oRefineByDefinition = $oRefineByDefinition;

$aParams7 = array("sQuery" => "", "bAdult" => false, "iLimit"=>10, "oActiveRefineByGroup" => $oRefineBy); }}}


Hope that helps,

Cheers