Guest User

Untitled

a guest
Jun 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. $oc_item_synchro_tbl = $this->getRs()->getTableName('oc_item_synchro');
  2. $oc_other_config = mysql_escape_string($serialized);
  3. $id = 255;
  4. $this->getConnection()->rawQuery("UPDATE $oc_item_synchro_tbl SET oc_other_config = '$oc_other_config' WHERE oc_product_id = '$id'");
  5.  
  6. public function addProduct($data)
  7. {
  8.  
  9. $oc_item_synchro = $this->getRs()->getTableName('oc_item_synchro');
  10. $id = (int)$data['oc_product_id'];
  11. $now = strtotime("Y-m-d h:ia");
  12. $conn = $this->getConnection('core_write');
  13.  
  14. $sql = "INSERT INTO $oc_item_synchro SET ";
  15. $sql .= "oc_product_id = :OC_PRODUCT_ID, ";
  16. $sql .= "oc_item_category_id = :OC_ITEM_CATEGORY_ID, ";
  17. $sql .= "oc_item_duration = :OC_ITEM_DURATION, ";
  18. $sql .= "item_delivery_time = :ITEM_DELIVERY_TIME, ";
  19. $sql .= "is_posted = :IS_POSTED, ";
  20. $sql .= "oc_synchro_time = :NOW";
  21. $binds = array(
  22. 'OC_PRODUCT_ID' => $id,
  23. 'OC_ITEM_CATEGORY_ID' => (int)$data['oc_item_category_id'],
  24. 'OC_ITEM_DURATION' => $data['oc_item_duration'],
  25. 'ITEM_DELIVERY_TIME' => $data['item_delivery_time'],
  26. 'IS_POSTED' => (!empty($data['is_posted']) ? 1 : 0),
  27. 'NOW' => $now
  28. );
  29. $conn->query($sql, $binds);
  30.  
  31. $sql2 = "UPDATE $oc_item_synchro SET ";
  32. $sql2 .= "oc_other_config = :OC_OTHER_CONFIG ";
  33. $sql2 .= "WHERE oc_product_id = :OC_PRODUCT_ID";
  34. $binds2 = array(
  35. 'OC_OTHER_CONFIG' => serialize($data['oc_other_config']),
  36. 'OC_PRODUCT_ID' => $id
  37. );
  38. $conn->query($sql2, $binds2);
  39. }
  40.  
  41. $objectManager = MagentoFrameworkAppObjectManager::getInstance();
  42. $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
  43. $connection = $resource->getConnection();
  44. $sql = "select * from mymodule_shipping where mymodule_shipping_id=$_REQUEST[m_shipping_id]";
  45. $sql = $connection->quote($sql);
  46. $connection->query($sql);
Add Comment
Please, Sign In to add comment