I'm using this function to request books from amazon that are priced at 0 but I am getting three different responses.
Some books are listed at 0
http://www.amazon.com/dp/B009EFZQV0/?tag=centsme-20
Some have a price
http://www.amazon.com/dp/B00A3H57CG/?tag=centsme-20
And others have a price but are free for prime members
can't find an example now
Now I looked at the source of the page and noticed multiple values for price and that I need the id pricelarge and listprice to both be 0. The faq doesn't help me at all and I'm getting stumped on how to fix this.
This is the query function I'm using now.
$search = new Search();
$conf->setRequest('\ApaiIO\Request\Soap\Request');
$conf->setResponseTransformer('\ApaiIO\ResponseTransformer\ObjectToArray');
$search->setCategory('MobileApps');
$search->setMaximumPrice(0);
$search->setPage($page);
$search->setBrowseNode($bid);
$search->setSort('reviewrank');
$search->setResponseGroup(array('ItemAttributes','ItemIds', 'Images'));
$formattedResponse = $apaiIO->runOperation($search, $conf);
For the response, I would also grab a price variable. That way you can double check the price of the item before you present it to your user.
Related
I am fairly new to OXID.
I am trying to perform an SQL query by using OXID functions only.
The point is to check if $discount exists in oxVoucherSerie's table oxdiscount, and if it exists get the oxid from oxVoucherSerie that corresponds to that discount.
Sadly I cannot use plain MySQL and I am only allowed to use oxid functions. I have no idea how to do it.
public function save_voucher($discount){
$o_voucherid = oxNew("oxVoucherSerie");
$aWhere_discount['oxdiscount'] = $discount;
$sSql = $o_voucherid->buildSelectString($aWhere_discount);
$b_exists = $o_voucher->assignRecord($sSql);
}
This tells me if the discount exists. However, I have no idea to retrieve oxid from said discount.
we might need to clarify some wording and variables first, because i'm not really sure what you are trying to achieve.
voucher - (also called "coupon") shop visitor can enter voucher/coupon code in basket to achieve a price reduction or a free product.
Vouchers are generated in Shop Settings -> coupon series
discount - general price reduction for some categories or articles, e.g. 10% for pet accessories.
Discounts can be configured in Shop Settings -> Discounts
okay, i updated my post.
your code works well, i just changed it a little bit. First the code and then the explanation:
$o_voucher = oxNew("oxVoucherSerie");
$aWhere_discount['oxdiscount'] = 25;
$sSql = $o_voucher->buildSelectString($aWhere_discount);
$o_voucher->assignRecord($sSql);
var_dump($o_voucher);
I replaced $o_voucherid with $o_voucher (without id)
$o_voucher = oxNew("oxVoucherSerie"); gives you an oxVoucherSeries Object
$o_voucher->assignRecord($sSql); does not only tell you if voucher series with such discount exists, it also will load this voucher serie into $o_voucher , so you can access all the (not protedted) parameters of this voucher serie by using $o_voucher, e.g.:
$o_voucher->getId() or $o_voucher->oxvoucherseries__oxid->value() for getting its oxID or just var_dump($o_voucher); to see all the objects properties
By the way, if you are developing with OXID 4.9 you could use this module: https://marat.ws/direct-access-to-oxid-framework-functions/ for quick evaluating and debugging you code.
just copy-paste the code from above into the textarea and hit the button
I just added price and sale_price attributes to my indexes in sphinx and it seemed like it was sorting just fine using, $s->SetSortMode(SPH_SORT_EXTENDED,'price desc');, however after a few pages the price shot back up again.
For instance, page one showed prices $1,000 - $800, page two showed prices $800 - $500, page three showed prices $500 - $200, then out of nowhere page four showed $300 - $100 or some random assortment of prices.
I'm wondering if sphinx is possibly still sorting by weight event though I haven't explicitly told it to... Does that sound like the problem?
I'm open to indulging any other ideas as well. Also, I definitely reindexed and rotated all indices and sphinx is not returning any errors.
Thanks in advance for your help.
Here are all the options I'm currently using: (update for #barryhunter)
$s->SetMatchMode(SPH_MATCH_BOOLEAN);
$s->SetSortMode(SPH_SORT_EXTENDED,'price desc');
$s->SetFilter("is_private", array(0));
$s->SetFilter("is_deleted", array(0));
$s->SetFilter("site_type", array(1));
$s->SetLimits($start, $count);
The answer was suggested in a comment by #barryhunter!
I added a new integer col to mysql called sort_price and filled it with (price * 100).
I then added that col as sql_attr_uint in sphinx and the sorting works perfecto!!
$s->SetSortMode(SPH_SORT_EXTENDED,'sort_price desc');
Thanks Barry :)
At a guess, are you using a Group-By?
If so, then SetSortMode does NOT set the order of the final results. The third param to setGroupBy does instead.
read the documentation on Group by to see how the two sort orders work.
Otherwise what column type do you store the price? Maybe its not getting converted to sphinxes float type correctly.
I am a beginner in programming and I don't know if my title suits my issue, but here is what I am dealing with:
I made a simple inventory program. I can insert, edit and delete entries and it all works perfect.
For my next challenge I need to make it that when an item gets sold out of the inventory that my database will flag that entry so that it will not show again in that list in the application. (Makes sense right? when u sell a product it can't still be there cuz its sold)
But since I am a beginner I have no idea whats o ever how to research this cuz I have never done this before! That's why its a challenge :)
Can you pls tell me what I should research to learn about how I should be doing this ?
Thank you in advanced for ur advice and attention!
And my apologies if this question is off-topic to this website but I don't know where else to ask since this website is so awesome!
Cheers
If products are coming INTO your inventory you would need to scan the products and the amount of how much has come in right? When you do this for a product you would just update the record with the ID of the product that has come in(By scanning the product you should get the ID I assume) and the update query could look something like this:
UPDATE myTable SET productStock=productStock+amount* WHERE productID = ID*
*Amount stands for the amount that came INTO your inventory.
*ID stands for the ID of the product.
The above was an intro, now your question which you can lead off of the above, when a customer wants your product, and clicks on it, orders it, you can do the UPDATE query again, but now MINUS 1 or whatever the amount the customer orders(again by doing multiple amounts you should always check if you have it in stock, but that's another part)
UPDATE myTable SET Stock=Stock-amount* WHERE productID = *ID
*Amount now stands for the amount that the customer orders OUT OFF your inventory.
*ID stands for the ID of the product.
When your "productStock" turns 0, you could simply modify or add a query which will only show values where the "productStock" IS NOT 0.
Example:
SELECT * FROM products WHERE productStock <>* 0;
*<> This symbol stands for NOT EQUAL and in some versions of SQL this is written as !=
Hopefully this would help you on your way.
EDIT:
Why you should not 'flag' or 'remove' the product out of your DB is because when it returns you don't have to fill in the entire product again...
I've a large table of products, and want to get related products based on a similarity of some kind - whether it is product code or title yet I am yet to decide.
What I want effectively is an output of the 4 most likely matches for a product based on title or code.
Example:
Product Code Related Products
JC83022 JC83021, JC83020, JC83029, JC8300
So I would ideally like a field appended to the product table which does some kind of string matching and returns the codes for the 4 most likely matches.
My idea is that I can use a MySQL query to perform this, but looking around PHP may have some better functions - maybe I could have a function on the product page that returns the products with the nearer levenshein distance - it's just how to query that against a table of over 30,000 products.
Cheers in advance.
I'm having problems getting a collection with join working. I'm trying to get the order ID's connected to customer telephone numbers, saved in sales_flat_order_address. So a join on the collection with sales/order and a filter based on the variable with my phone number in it. I've tried all sorts of combinations, but so far I only get errors and right now I've deleted my code and will try from scratch. Any ideas or links to tutorials about this?
Small code snippet below
$customer = Mage::getModel('customer/customer')->getCollection()
->addAttributeToFilter('attribute_code', value)->load();
//Here your attribute code is phone
$orderCollection = Mage::getModel(’sales/order’)->getCollection();
$orderCollection->getSelect()->where(’e.customer_id =’.$customer->getId());
:)