当前位置: 首页>>代码示例>>PHP>>正文


PHP ProductCategory::delete方法代码示例

本文整理汇总了PHP中ProductCategory::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductCategory::delete方法的具体用法?PHP ProductCategory::delete怎么用?PHP ProductCategory::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProductCategory的用法示例。


在下文中一共展示了ProductCategory::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteCategory

 public function deleteCategory($id)
 {
     $db = $this->db;
     $deleted = new ProductCategory();
     $deleted->delete($db, $id);
 }
开发者ID:eepletnev,项目名称:way-cup-erp,代码行数:6,代码来源:exes.products_manager.php

示例2: workflow

 /**
  * Handles loading, saving and deleting categories in a workflow context
  *
  * @author Jonathan Davis
  * @since 1.0
  * @return void
  **/
 public function workflow()
 {
     $defaults = array('action' => false, 'selected' => array(), 'page' => false, 'id' => false, 'save' => false, 'next' => false, '_wpnonce' => false);
     $args = array_merge($defaults, $_REQUEST);
     extract($args, EXTR_SKIP);
     if (!defined('WP_ADMIN') || $page != $this->page()) {
         return false;
     }
     $adminurl = admin_url('admin.php');
     add_screen_option('per_page', array('label' => __('Categories Per Page', 'Shopp'), 'default' => 20, 'option' => 'edit_' . ProductCategory::$taxon . '_per_page'));
     if ('delete' == $action && wp_verify_nonce($_wpnonce, 'shopp_categories_manager')) {
         if (!empty($id)) {
             $selected = array($id);
         }
         $total = count($selected);
         foreach ($selected as $selection) {
             $DeletedCategory = new ProductCategory($selection);
             $deleted = $DeletedCategory->name;
             $DeletedCategory->delete();
         }
         if (1 == $total) {
             $this->notice(Shopp::__('Deleted %s category.', "<strong>{$deleted}</strong>"));
         } else {
             $this->notice(Shopp::__('Deleted %s categories.', "<strong>{$total}</strong>"));
         }
         $reset = array('selected' => null, 'action' => null, 'id' => null, '_wpnonce' => null);
         $redirect = add_query_arg(array_merge($_GET, $reset), $adminurl);
         Shopp::redirect($redirect);
         exit;
     }
     if ($id && 'new' != $id) {
         $Category = new ProductCategory($id);
     } else {
         $Category = new ProductCategory();
     }
     $meta = array('specs', 'priceranges', 'options', 'prices');
     foreach ($meta as $prop) {
         if (!isset($Category->{$prop})) {
             $Category->{$prop} = array();
         }
     }
     if ($save) {
         $this->save($Category);
         // Workflow handler
         if (isset($_REQUEST['settings']) && isset($_REQUEST['settings']['workflow'])) {
             $workflow = $_REQUEST['settings']['workflow'];
             $working = array_search($id, $this->worklist);
             switch ($workflow) {
                 case 'close':
                     $next = 'close';
                     break;
                 case 'new':
                     $next = 'new';
                     break;
                 case 'next':
                     $key = $working + 1;
                     break;
                 case 'previous':
                     $key = $working - 1;
                     break;
             }
             if (isset($key)) {
                 $next = isset($this->worklist[$key]) ? $this->worklist[$key] : 'close';
             }
         }
         if ($next) {
             if ('new' == $next) {
                 $Category = new ProductCategory();
             } else {
                 $Category = new ProductCategory($next);
             }
         } else {
             if (empty($id)) {
                 $id = $Category->id;
             }
             $Category = new ProductCategory($id);
         }
     }
     ShoppCollection($Category);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:87,代码来源:Categories.php

示例3: shopp_rmv_product_category

/**
 * Remove a product category by id
 *
 * @api
 * @since 1.2
 *
 * @param int $id (required) The category id
 * @return bool true on success, false on failure
 **/
function shopp_rmv_product_category($id = false)
{
    if (!$id) {
        shopp_debug(__FUNCTION__ . " failed: Category id required.");
        return false;
    }
    $Category = new ProductCategory($id);
    if (empty($Category->id)) {
        return false;
    }
    return $Category->delete();
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:21,代码来源:collection.php


注:本文中的ProductCategory::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。