When using helpers that return an array of certificate data, you may need detailed information about this array.
Places where you will need information from the article:
- Features of the helper generateOneCertificate
- Examples of certificate's generating
- Certificate templates
- Notifications when changing the states
- Certificate generating
Let's look at the certificate data array:
/** * Certificate data * * array['id'] int certificate ID * array['code'] string certificate code * array['to'] string Field "To" * array['from'] string Field "From" * array['send'] string Field "Method of sending the certificate". Available values: email, post, user, not * array['message'] string Field "Message" * array['amount'] float Field "Amount" * array['currency'] string Field with currency * array['state_id'] int Certificate state ID * array['email'] string Field "Email" for parameter send = email * array['post'] array Shipping address for parameter send = post * array['post']['country'] string Country iso3letter format * array['post']['region'] int Region ID * array['post']['city'] int City name * array['post']['street'] int Street field * array['post']['postcode'] int Postcode * array['post']['phone'] string Phone * array['create_contact_id'] int Contact ID, who created the certificate * array['create_datetime'] string Create datitime * array['order_id'] int Order ID, where the certificate was created * array['contact_id'] int Contact ID that the certificate is intended for. Required, if parameter send = user * array['use_limitations'] int Use the limitations or not. Available values: 1 or 0 * array['limitations'] array Limitations data * array['limitations']['expired'] string Expired date of the certificate in format: Y-m-d * array['limitations']['lifetime'] int Lifetime of the certificate in days. * array['limitations']['max'] float The maximum amount that can be spent in %. Specify values from 0 to 100 * array['limitations']['min'] array Information about the minimum order amount * array['limitations']['min']['value'] float Minimal order sum * array['limitations']['min']['currency'] string Currency of the minimal order sum * array['lifetime_left'] int The remaining number of days before the certificate expires. Appears if limitations are used * array['lifetime_expired'] string Date of expiry of the certificate. Appears if limitations are used * array['is_expired'] int Appears only if the certificate has expired * array['usage'] array Data about the usage of the certificate * array['usage']['type'] string Certificate type: disposable or multiple * array['template'] string Certificate template * array['template_is_changed'] int Has the standard template been changed * array['default_template'] string Symbolic code of the default template. * array['products'] array Free products * array['products'][]['id'] int product or sku ID. Depends on parameter "type" (see below) * array['products'][]['certificate_id'] int certificate ID * array['products'][]['product_id'] int product ID * array['products'][]['sku_id'] int sku ID * array['products'][]['name'] string Product name * array['products'][]['price'] float Price of the product at the time of ordering the certificate * array['products'][]['type'] string Product type: common product or definite sku. Available values: products or skus * * @param array $certificate (See the parameters above) * @return array **/ $certificate = [ 'id' => 51, 'code' => 'GC-TTWQ9CKX96EJE', 'to' => 'Best customer', 'from' => 'Favourite store', 'send' => 'email', 'message' => '', 'amount' => '50', 'currency' => 'USD', 'state_id' => 5, 'email' => 'test@test.com', 'post' => [ 'country' => 'rus', 'region' => '77', 'city' => 'Moscow', 'street' => 'street, building, apt', 'postcode' => '353535', 'phone' => '89999999999', 'address' => '353535, Russian Federation, Moscow, street, building, apt' ], 'create_contact_id' => 5, 'create_datetime' => '2020-08-17 08:08:30', 'order_id' => 399, 'contact_id' => 7, 'limitations' => [ 'expired' => '2040-10-28', 'lifetime' => 30, 'max' => 100, 'min' => [ 'value' => 10, 'currency' => 'USD' ] ], 'usage' => [ 'type' => 'disposable' ], 'lifetime_left' => 27, 'lifetime_expired' => '2020-12-09', 'is_expired' => 1, 'template' => 'certificate HTML', 'template_is_changed' => 1, 'default_template' => 'template3', 'products' => [ [ 'id' => 8740, 'certificate_id' => 51, 'product_id' => 8740, 'sku_id' => 36698, 'name' => 'Product name', 'price' => 1236.25, 'type' => 'products', ], [ 'id' => 37898, 'certificate_id' => 51, 'product_id' => 8756, 'sku_id' => 37898, 'name' => 'Product name (sku)', 'price' => 700, 'type' => 'skus', ] ]