當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Shopp::object_r方法代碼示例

本文整理匯總了PHP中Shopp::object_r方法的典型用法代碼示例。如果您正苦於以下問題:PHP Shopp::object_r方法的具體用法?PHP Shopp::object_r怎麽用?PHP Shopp::object_r使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Shopp的用法示例。


在下文中一共展示了Shopp::object_r方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _object_r

/**
 * @deprecated Use Shopp::_object_r()
 **/
function _object_r($object)
{
    return Shopp::object_r($object);
}
開發者ID:BlessySoftwares,項目名稱:anvelocom,代碼行數:7,代碼來源:Core.php

示例2: ipn

 /**
  * Updates purchase records from an IPN message
  *
  * @author Jonathan Davis, John Dillick
  * @since 1.0
  * @version 1.2
  *
  * @return void
  **/
 public function ipn()
 {
     if (!$this->ipnvalid()) {
         return;
     }
     $Message = $this->Message;
     shopp_debug('PayPal IPN response protocol: ' . Shopp::object_r($Message));
     $id = $Message->order();
     $event = $Message->event();
     $Purchase = new ShoppPurchase($id);
     if (empty($Purchase->id)) {
         $error = 'The IPN failed because the given order does not exist.';
         shopp_debug($error);
         status_header('404');
         die($error);
     }
     $this->process($event, $Purchase);
     status_header('200');
     die('OK');
 }
開發者ID:forthrobot,項目名稱:inuvik,代碼行數:29,代碼來源:PayPalStandard.php

示例3: shopp_add_product

/**
 * Comprehensive product creation through Product Developer API.
 *
 * This function will do everything needed for creating a product except
 * attach product images and products. That is done in the Asset API. :)
 * You should be able to build an importer from another system using this function.
 *
 * It is also possible to update an existing product (by passing the
 * existing id as part of the $data array) or else you can alternatively
 * use shopp_update_product() for that.
 *
 * @todo possibly remove the capability of passing in an id to update a product
 *
 * @api
 * @since 1.2
 *
 * @param array $data (required) associative array structure containing a single product definition, see _validate_product_data for how this array is structured/validated.
 * @return Product the created product object, or boolean false on a failure.
 **/
function shopp_add_product($data = array())
{
    if (empty($data)) {
        shopp_debug(__FUNCTION__ . " failed: Empty data parameter.");
        return false;
    }
    $problems = _validate_product_data($data);
    if (!empty($problems)) {
        shopp_debug("Problems detected: " . Shopp::object_r($problems));
        return false;
    }
    $Product = new ShoppProduct();
    // Set Product publish status
    if (isset($data['publish'])) {
        $Product->publish = _shopp_product_publish_date($data['publish']);
        if ($Product->publish > 0) {
            $Product->status = 'future';
        }
    }
    // Set Product name
    if (empty($data['name'])) {
        shopp_debug(__FUNCTION__ . " failed: Missing product name.");
    }
    $Product->name = $data['name'];
    // Set Product slug
    if (!empty($data['slug'])) {
        $Product->slug = $data['slug'];
    }
    if (empty($Product->slug)) {
        $Product->slug = sanitize_title($Product->name);
    }
    $Product->slug = wp_unique_post_slug($Product->slug, $Product->id, $Product->status, ShoppProduct::posttype(), 0);
    $Product->updates($data, array('meta', 'categories', 'prices', 'tags', 'publish'));
    $Product->save();
    ShoppProduct::publishset(array($Product->id), $data['publish']['flag'] ? 'publish' : 'draft');
    if (empty($Product->id)) {
        shopp_debug(__FUNCTION__ . " failed: Failure to create new Product object.");
        return false;
    }
    // Product-wide settings
    $Product->featured = isset($data['featured']) && true === $data['featured'] ? "on" : "off";
    $Product->variants = isset($data['variants']) ? "on" : "off";
    $Product->addons = isset($data['addons']) ? "on" : "off";
    if (isset($data['packaging'])) {
        $packaging_set = shopp_product_set_packaging($Product->id, $data['packaging']);
        if (!$packaging_set) {
            shopp_debug(__FUNCTION__ . " failed: Failure to set packaging setting.");
            return false;
        }
    }
    // Save Taxonomies
    // Categories
    if (isset($data['categories']) && isset($data['categories']['terms'])) {
        $cats_set = shopp_product_add_categories($Product->id, $data['categories']['terms']);
        if (!$cats_set) {
            shopp_debug(__FUNCTION__ . " failed: Failure to add product categories to product.");
            return false;
        }
    }
    // Tags
    if (isset($data['tags']) && isset($data['tags']['terms'])) {
        $tags_set = shopp_product_add_tags($Product->id, $data['tags']['terms']);
        if (!$tags_set) {
            shopp_debug(__FUNCTION__ . " failed: Failure to add product tags to product.");
            return false;
        }
    }
    // Terms
    if (isset($data['terms']) && isset($data['terms']['terms']) && isset($data['terms']['taxonomy'])) {
        $terms_set = shopp_product_add_terms($Product->id, $data['terms']['terms'], $data['terms']['taxonomy']);
        if (!$terms_set) {
            shopp_debug(__FUNCTION__ . " failed: Failure to add product taxonomy terms to product.");
            return false;
        }
    }
    // Create Specs
    if (isset($data['specs'])) {
        $specs_set = shopp_product_set_specs($Product->id, $data['specs']);
        if (!$specs_set) {
            shopp_debug(__FUNCTION__ . " failed: Failure to add product specs to product.");
            return false;
//.........這裏部分代碼省略.........
開發者ID:forthrobot,項目名稱:inuvik,代碼行數:101,代碼來源:product.php


注:本文中的Shopp::object_r方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。