Jump to content

elham_K

Members
  • Posts

    8
  • Joined

  • Last visited

About elham_K

  • Birthday 04/16/1984

Profile Information

  • Activity
    Developer

elham_K's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi everyone! I've created a Admin controller with an object model for table but when I use helper form for editing a row of table my changes doesnt save in database. and row that I've edit will be removed from list view !! this is my controller code: -------------------------------------------------------------------------------------------------------- <?php class AdminResellersreqControllerCore extends AdminController { public $description; public function initProcess() { $this->id_object = Tools::getValue('id_'.$this->table); if (Tools::isSubmit('changeStatus') && $this->id_object) $this->action = 'change_status'; parent::initProcess(); } public function __construct() { $this->bootstrap = true; $this->table = 'resellers_req'; $this->className = 'Resellersreq'; $this->lang = false; // Building the list of records stored within the "resellersreq" table $this->fields_list = array( 'firstname' => array( 'title' => $this->l('First Name'), 'align' => 'center', ), 'lastname' => array( 'title' => $this->l('Last Name'), 'width' => 'auto', ), 'req_date' => array( 'type' => 'date', 'title' => $this->l('Request Date'), 'width' => 'auto' ), // 'description' => array( // 'title' => $this->l('Description'), // 'width' => 'auto' // ), // 'status' => array( // 'title' => $this->l('Status'), // 'type' => 'bool', // 'callback' => 'ShowStatusIcon', // 'width' => 'auto' // ), 'id_customer' => array( 'title' => $this->l('Edit Group'), 'callback' =>'ShowCustomerGroupLink', 'width' => 'auto' ), ); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?') ) ); parent::__construct(); $id_shop = $this->context->shop->id; $this->_select = ' a.*, cu.firstname, cu.lastname'; $this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer cu ON (cu.id_customer = a.id_customer)'; $this->_where = 'AND a.id_shop = '.(int)$id_shop; $this->processFilter(); } // This method generates the list of results public function renderList() { $this->addRowAction('edit'); return parent::renderList(); } public function renderForm() { $this->fields_form = array( 'legend' => array( 'title' => $this->l(''), ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Customer Description'), 'name' => 'description', //'values' => $this->description, 'style' => '', 'readonly' => true, //'class' => 't', 'rows' => 5, 'cols' => 35, // 'required' => true, 'desc' => $this->l('Customer Description'), ), array( 'type' => 'switch', 'label' => $this->l('Accept'), 'desc' => $this->l('Accepting or Rejecting a Customer'), 'name' => 'status', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Accept') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Reject') ) ), ), array( 'type' => 'textarea', 'autoload_rte' => true, //'class' => 'input fixed-width-sm', 'label' => $this->l('Shop Description'), 'name' => 'shop_description', 'rows' => 5, 'cols' => 35, // 'required' => true, 'desc' => $this->l('Your description for customer'), ), ), 'submit' => array( 'title' => $this->l(' Save '), 'class' => 'button btn btn-default pull-right' ) ); return parent::renderForm(); } public function ShowStatusIcon($id_resellers_req, $tr) { $resellersreq = new Resellersreq($tr['id_resellers_req']); if (!Validate::isLoadedObject($resellersreq)) return; return '<a class="list-action-enable'.($resellersreq->status ? ' action-enabled' : ' action-disabled').'" href="index.php?tab=AdminResellersreq&id_resellers_req='.(int)$resellersreq->id.'&changeStatus&token='.Tools::getAdminTokenLite('AdminResellersreq').'"> '.($resellersreq->status ? '<i class="icon-check"></i>' : '<i class="icon-remove"></i>'). '</a>'; } public function ShowCustomerGroupLink($id_resellers_req, $tr) { $resellersreq = new Resellersreq($tr['id_resellers_req']); if (!Validate::isLoadedObject($resellersreq)) return; return '<a class="edit btn btn-default" href="index.php?tab=AdminCustomers&id_customer='.(int)$resellersreq->id_customer.'&updatecustomer&token='.Tools::getAdminTokenLite('AdminCustomers').'"> '.$this->l('Edit Group').' </a>'; } public function processChangeStatus() { $resellersreq = new Resellersreq($this->id_object); if (!Validate::isLoadedObject($resellersreq)) $this->errors[] = Tools::displayError('An error occurred while updating this Request.'); $update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'resellers_req` SET status = '.($resellersreq->status ? 0 : 1).' WHERE `id_resellers_req` = '.(int)$resellersreq->id); if (!$update) $this->errors[] = Tools::displayError('An error occurred while updating this Request.'); Tools::clearSmartyCache(); Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } } ----------------------------------------------------------------------------------- Code of Object Model : class ResellersreqCore extends ObjectModel { public $id; public $status; public $id_customer; public $firstname; public $lastname; /** @var string Name */ public $name; //public $editgroup; //public $shop_description; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'resellers_req', //'multishop' => true, 'primary' => 'id_resellers_req', 'fields' => array( 'id_shop' => array( 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId' ), 'id_customer' => array( 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId' ), 'req_date' => array( 'type' => self::TYPE_DATE, 'validate' => 'isDateFormat', ), 'description' => array( 'type' => self::TYPE_STRING, ), 'status' => array( 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId', ), 'shop_description' => array( 'type' => self::TYPE_STRING, ), ), ); public function __construct($id_shop = null) { parent::__construct($id_shop); } } ---------------------------------------------------------------------------------------------------------------- Could anyone Help me? Tanx.
  2. I found out that in html code of my admin controller page the class of div with content id is nobootstrap <div id="content" class="nobootstrap" > but in another admin controllers like adminproduct controller the class of div with content id is bootstrap <div id="content" class="nobootstrap" > where can I change this class? in which file or how? could anyone help me please?
  3. Hi everyone, I created a new admin controller in prestashop, I used helperlist but view of my admin page is distorted. ----------------------------------------------------------------------------------------------------------- I've followed these steps : 1. - I created /controllers/admin/AdminResellersreqController.php like so: class AdminResellersControllerCore extends AdminController{} 2. I created /classes/Resellersreq.php like class ResellersreqCore extends ObjectModel{} 3. I created ps_resellers_req table -------------------------------------------------------------------------------------------------- this is my admincontroller code : class AdminResellersreqControllerCore extends AdminController { public function initProcess() { $this->id_object = Tools::getValue('id_'.$this->table); if (Tools::isSubmit('changeStatus') && $this->id_object) $this->action = 'change_status'; parent::initProcess(); } public function __construct() { $this->table = 'resellers_req'; $this->className = 'Resellersreq'; $this->lang = false; $this->fields_list = array( 'req_date' => array( 'type' => 'date', 'title' => $this->l('Request Date'), 'width' => 'auto' ), 'description' => array( 'title' => $this->l('Description'), 'width' => 'auto' ), 'status' => array( 'title' => $this->l('Status'), 'type' => 'bool', 'width' => 'auto' ), 'id_customer' => array( 'title' => $this->l('Edit Group'), // 'type' => 'text', 'callback' =>'ShowCustomerGroupLink', 'width' => 'auto' ), ); parent::__construct(); } // This method generates the list of results public function renderList() { $this->simple_header = true; return parent::renderList(); } } ------------------------------------------------------------------------------------------------------ But the view of my admin page haven't any css!! could anyone help me? view of may admin page controller : controllerpage.bmp
  4. I find the solution, I delete class_index.php file in cache folder and It works now.
  5. Hi , I did all of this steps but I have this error! I created class AdminExampleController in /controllers/admin but I don't understand why I have this error ! Could anyone help me please? ( ! ) Fatal error: Class 'AdminExampleController' not found in C:\wamp\www\Keshtgar\prestashop\classes\controller\Controller.php on line 135 Call Stack # Time Memory Function Location 1 0.0022 384272 {main}( ) ..\index.php:0 2 0.5456 8470448 DispatcherCore->dispatch( ) ..\index.php:54 3 0.6517 8860504 ControllerCore::getController( ) ..\Dispatcher.php:366
  6. Hi all, Please Help Me! we have 2 shops that they have common customers , we want customers in each shop belong to a group. for example if we have 2 shops: shop1, shop2 , one customer :customer1 (that is a common customer in these 3 shops), and we have 2 groups in 2 shops : group1 in shop 1, group2 in shop2. we want customer1 belongs(access) to group1 in shop 1, and group 2 in shop 2, but if am moderator of shop 1 add group 1 to customer 1 , and then moderator of shop 2 add group2 to customer 1 this access group will overwrite!!! , I mean customer 1 only belongs to group1 not group 1 and group 2! what I should do in order that customer 1 belongs to these two groups. Thanks for your attention.
  7. We have some companies that have their own products, we want a common site for all of these companies , then we want sellers can see a list of companies and can send requests to these companies to become a customer of them. when one company accept requests of one seller, this seller can see products of this company in the shop and can buy its products. We used multistore feature in presta, and created a shop for each of these companies , but We want a page that show to a seller only products of companies that he is a customer of them . As far as I know in presta each shop has an individual page but we want to have a page that show products of all shop in one page and each seller see only products of companies (shops) that he is a customer of them. Can we have these feature? Thanks for your attention.
  8. We have some companies that have their own products, we want a common site for all of these companies , then we want sellers can see a list of companies and can send requests to these companies to become a customer of them. when one company accept requests of one seller, this seller can see products of this company in the shop and can buy its products. We used multistore feature in presta, and created a shop for each of these companies , but I don't know how can we have a front page that shows all products of all shops in one page? and how can I have a page that shows a list of all shops(companies) that seller can select his desire companies? is there this features in ps ? Please help me! Thanks for your attention.
×
×
  • Create New...