if anybody can explain how this api work or take the paramaters when u search for a product . how this product status ,category id reflects .
seproduct/api/products?status.equals=Published&categoryId.in=59&name.contains=protein%20123&foodTypeId.in=1&allergenId.in=2&page=1&size=20&sort=sellingPrice,DESC
I can just guess because you don't provide the code or any documentation of the API.
This is the path:
seproduct/api/products?
Parameters
.equals and .in would translate to = and IN in SQL select.
contains probably to like '%<keywords>%'
status.equals=Published
categoryId.in=59
name.contains=protein%20123
foodTypeId.in=1
allergenId.in=2
Page and size are used for pagination and sort for sorting (DESC = descending)
page=1
size=20
sort=sellingPrice,DESC
Related
Paginate not working for specific model. with all Models, paginate is working fine except one specific model. Also tried with query builder.
$doubts = DB::table('users')->paginate(10);
dd($doubts->count());
//output: 10
$doubts = DB::table('doubts')->paginate();
dd($doubts->count());
//output: 0
$doubts = DB::table('doubts')->get();
dd($doubts->count());
//output: 8
Don't know what am I missing here. Please help.
Maybe I think you have to put
How many results you want to show per page
So if you want 8
Then I think it should be something like this
$doubts = DB::table('doubts')->paginate(8);
dd($doubts->count());
And if you are using pages Number under your data then you might need the query builder.
You should pass number argument inside paginate function.
Look at laravel pagination documentation
And make sure that DB::table('doubts')
Is returning collection
I thing you must add parameter in paginate(), to show how much data that show per page. You can read documentation in : https://laravel.com/docs/9.x/pagination#paginating-query-builder-results
https://laravel.com/docs/9.x/pagination#cursor-pagination
because you are not add parameter in paginate, it means not data that show every page.
$doubts = DB::table('doubts')->paginate(10);
I am using "Send an HTTP Request to Sharepoint" action, and I want to filter the output to only include the project with ID = [user input filed in "Manually trigger a flow"]
My Uri seems to not be working and can't find errors; I have used this action before with no problems, can't figure what syntax (?) problem I may have?
Here is the Uri:
_api/ProjectData/Projects()?$Filter=ProjectUID eq '#{variables('proj id')}'&?Select=ProjectName,ProjectWorkspaceInternalUrl,ProjectUID,ProjectIdentifier
Can anyone spot the problem?!
Thanks so much in advance :)
For the URI try the following instead:
/_api/ProjectData/Projects()?$filter=ProjectId eq guid'xxxxx' &$Select=ProjectName,ProjectWorkspaceInternalUrl,ProjectId,ProjectIdentifier
where xxxx is your project id or in this case #{variables('proj id')}
It makes it easier to deal with the data as it doesn't return an array.
How to get multiple orders filtered by Id from magento with help of rest api?
I tryed to use http://192.168.0.104:4422/magento/api/rest/orders?filter[1][attribute]=entity_id&filter[1][in]=1&filter[1][in]=3
but it returns me:
<magento_api>
<messages>
<error>
<data_item>
<code>401</code>
<message>oauth_problem=signature_invalid</message>
</data_item>
</error>
</messages>
</magento_api>
But if i use request with only one filter in parameter http://192.168.0.104:4422/magento/api/rest/orders?filter[1][attribute]=entity_id&filter[1][in]=1 - it works great.
For me the problem was in filters( I tried on 1.7.0.1). Looks like some magento versions have problems with filters. So you should use 1 filter, after that filter results in your code.
I found the answer in this blog post. In short, if you follow this structure (this was for my use case with a list of products):
http://magentohost.com/api/rest/products?filter[1][attribute]=entity_id&filter[1][in][1]=1&filter[1][in][2]=3
You'll be set! (this gets two products similar to above with ids 1 and 3). Notice the [1] and [2] after both of the [in]. I wish Magento had better documentation for this.
Try aggregating values.
complexFilter { key = "increment_id", value = new associativeEntity {key = "in", value = "1,2,3"} };
I have a content type called Author which is referred in another two content types called Novel and Book via Node Reference Module.So we can add author entity to both Book and Novel content types.
Both Novel and Book contain another field called Release Date.
Now I want to show a block which will display the name of book and name of novel in chronological order based upon the release date when user come to that corresponding Author Page.
Ex. Suppose A is an author who is author of BookA(Release Yr-2006), NovelB(Release Yr-2004),BookC(Release Year-2009). When user come to Author A page then he will be shown a block which will show the Books/Albums in chronological order like this:-
NovelB--BookA--BookC
Please suggest as how to achieve in Drupal 7.
You want to display the following field title (I assume the book name is the node title)
For the sorting you can use the sort option in views, it is pretty self-explaining. Choose the name of your release date field.
For the connection between author and books you will have to use a contextual filter (advanced).
Add the author-reference-field from your book/novel (the field you use to refer to the author). Then choose to use a default value (2nd option) and choose content id from url. Now your block will find all nodes that refer to the page with the current page-id. Since we chose to display the title fields, you should see a list.
Note that live preview does not work here, so you will have to go to the actual page to see the result.
UPDATE:
This works when you have re-used the same field for both content types. If you have uses more then one field you will have to use an OR operator to make the contextual filter work. Thanks to d34dman the following page was given to do just that.
Although for new implementations I would recommend using the same field (eg. reference_to_author) for all references from all content types.
Yah..I am able to solve this problem by adding custom code. I have used hook_views_query_alter method and then added join relationship and where clause as per requirement. Please refer to following article for more clarity..
http://www.midwesternmac.com/blogs/jeff-geerling/filtersearch-multiple-fields
Thanks for posting the reply and keeping my hope alive.
We would like to be able to pull the name and email address of customers who purchased items as a guest. Has anyone had any luck in doing so?
I've seen a few posts of how to pull the names of customers who have used the coupon code, but nothing about non-customers!
Thank you guys very much for your help!
-Jeff
This should work:
$orderCollection = Mage::getModel('sales/order')->getCollection()
->addAttributeToSelect('customer_firstname')
->addAttributeToSelect('customer_lastname')
->addAttributeToSelect('customer_email')
->addAttributeToSelect('customer_group_id')
->addAttributeToFilter('customer_group_id', Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
;
You can then access the values by iterating over the collection...
foreach($orderCollection as $order) {
$customerFirstname = $order->getData('customer_firstname');
$customerLastname = $order->getData('customer_lastname');
$customerEmail = $order->getData('customer_email');
//Do what you want with the values here
}
EDIT:
The above code answers the first paragraph of your question. The second paragraph suggests you are looking for something different though. Are you looking for guest customers who have used a particular coupon code? If so then you should load the collection like this:
$orderCollection = Mage::getModel('sales/order')->getCollection()
->addAttributeToSelect('customer_firstname')
->addAttributeToSelect('customer_lastname')
->addAttributeToSelect('customer_email')
->addAttributeToSelect('customer_group_id')
->addAttributeToSelect('coupon_code')
->addAttributeToFilter('customer_group_id', Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
->addAttributeToFilter('coupon_code', 'your_awesome_coupon_code')
;
Drew gave me a SQL statement for names and emails of the existing customers in another similar post. To get all orders including registered users and guests you can use this SQL:
SELECT `customer_firstname`, `customer_lastname`, `customer_email` FROM `sales_flat_order` WHERE `coupon_code` = 'your_awesome_coupon_code'
Worked like a charm! Double-checked in 'salesrule_coupon' and the rows returned in the sql matches the number of times the coupon was used.
I will leave Drew's answer marked as correct, since it is probably better to do it in magento. Anyone looking for the SQL though, use this one!
The SQL statement for registered users only can be found here: How can I see full order details for each time a certain coupon code was used in magento?