How can I create a "Product" of a Store programatically in SocialEngine (I am having StorePlugin)

StackOverflow https://stackoverflow.com/questions/19508240

  •  01-07-2022
  •  | 
  •  

Question

I have Socialengine with Store Plugin.... I want to create a product in store programatically(Not using GUI and Not using Admin Panel) from an other module like events.

Was it helpful?

Solution

Steps 1. Get the owner_id from viewer 2. Query for store_id from "sitestore_stores" table 3. Create an array having all the fields like in table "sitestoreproduct_product" 4. get the Adapter

$table = Engine_Api::_()->getItemTable('sitestoreproduct_product');
$db = $table->getAdapter();
$db->beginTransaction();
  1. Create Row and set the created array and then save

    $sitestoreproduct = $table->createRow();
    $sitestoreproduct->setFromArray($values); $sitestoreproduct->save();

  2. Finally Commit the Database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top