Perch API - Get sku from product

  • Hello,


    I am trying to get the sku from a product, using the product id which I am getting from a shop order.

    Could anyone tell me how I can get the sku from the following product:


    Code
    1. $Products = new PerchShop_Products($this->api);
    2. $Product = $Products->find((int)1);
  • Well I am extending the PerchShop_Order.class.php to send the order through an external API. For that I am using the following code:



    Now I hardcoded the productcode (SKU) and the quantity and it is working fine. But now I have to get the productcode (SKU) and quantity for each product sold. Is there a way in which I could get those variables?

  • Is there a way in which I could get those variables?


    There probably is, but again this is not part of the public API.



    Well I am extending the PerchShop_Order.class.php to send the order through an external API.


    One supported way of doing this is to write an app with an event listener to listen to the event Perch Shop fires when an order is complete. Hopefully the event returns all the data you need.

  • One supported way of doing this is to write an app with an event listener to listen to the event Perch Shop fires when an order is complete. Hopefully the event returns all the data you need.


    Thank you for this, I think I can use this very well.


    Regarding the product SKU's, I found a solution by looking for the productID in the database and getting the SKU from that productID:

    SQL
    1. SELECT sku FROM perch3_shop_products WHERE productID = $productID