Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. include_once '../app/Mage.php';
  4.  
  5. /**
  6. * @author odahcam
  7. *
  8. * @version 1.0.0
  9. *
  10. * @param {string|int} $product_id
  11. *
  12. * @return {string}
  13. **/
  14. function getSkuById($product_id)
  15. {
  16. $adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
  17.  
  18. $select = $adapter
  19. ->select()
  20. ->from(Mage::getResourceModel('catalog/product')->getEntityTable(), 'sku')
  21. ->where('entity_id = :entity_id');
  22.  
  23. return $adapter->fetchOne($select, [':entity_id' => (string) $product_id]);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement