gplsek / fitmoostore

fitmostore
GNU General Public License v2.0
0 stars 0 forks source link

Random product not found #28

Open gplsek opened 10 years ago

gplsek commented 10 years ago

There were some order that returned 'product not found' when calling /fit_store/order/404 - this order returned 'product not found' on stage.store.fitmoo.com

I tested after taking the stage database and found the function bellow for some reason was trying retrieve produict id from shipping, and since prodId was not loading it returned the product not found statement.

I addd the if statement and it seems to fix the issue, can you please check make sure all data is still working properly

function commerce_services_order_retrieve_access($order_id) {

// Attempt to load the order. if ($order = commerce_order_load($order_id)) { $result = false; foreach ($order->commerce_line_items['und'] as $key=>$value) { $line_item = $entity = entity_load_single('commerce_line_item', $value['line_item_id']); //print_r($line_item);die(0) //commerce_services_retrieve_entity('commerce_line_item', $value->line_item_id); //commerce_services_line_item_retrieve($value->line_item_id); if($line_item->line_item_label){ // check on this, beore it was returning product not founf for orderID 404 $product = commerce_product_load_by_sku($line_item->line_item_label); $result = commerce_services_product_retrieve_access($product->product_id); if ($result == true) {return TRUE;} } }