Jump to content

SUBIECTE NOI
« 1 / 5 »
RSS
Țuica are gust ciudat

Copii nascuti in Romania

Ușa exterioara care scar5...

Felicitari Republica Moldova pent...
 Decizie dificila intre doua model...

Orange nu onoreaza premiile din P...

Ungere mecanism usa metalica de a...

Probleme baterie monde 3
 Tipuri de acces Gura Portitei, di...

Crearea unei formule Excel cu div...

Filme ce urmeaza in 2024 - horror

Tarot (2024)
 Prescriere datorii parinti decedati

Utilizare credit cartela Vodafone

La multi ani @Cousteau !

Inlocuire hdd cu ssd la NVR
 

Prestashop - Adaugare flag nou pe comenzi

- - - - -
  • Please log in to reply
5 replies to this topic

#1
h0tice

h0tice

    Member

  • Grup: Members
  • Posts: 379
  • Înscris: 21.03.2005
Salutare,

Vreau sa fac o mica modificare in adminul de Prestashop. Doresc sa imi fie mai usor sa urmaresc ce comenzi au fost incasate (nu ma ajutata status-urile, pentru ca acelea sunt vazute de clienti).

Ce am facut pana acum...

- am adaugat o coloana noua in tabela ps_orders:
Attached File  ps_orders-add-column.jpg   31.68K   24 downloads

- in AdminOrdersController.php, on line 67 I added is_paid,
Acel select a devenit:
$this->_select = '
  a.id_currency,
  a.id_order AS id_pdf,
  CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
  osl.`name` AS `osname`,
  os.`color`,
  IF((SELECT so.id_order FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new,
  country_lang.name as cname,
  is_paid,
  IF(a.valid, 1, 0) badge_success';

- in AdminOrdersController.php, incepand cu linia 153 am adaugat:
'is_paid' => array(
	'title' => $this->l('Incasata'),
	'active' => 'statuspaid',
	'filter_key' => $alias.'!is_paid',
	'align' => 'text-center',
	'type' => 'bool',
	'class' => 'fixed-width-sm',
	'orderby' => false
   )

- acum, cu modificarile respective, in interfata de comenzi din admin am noua coloana, care este populata corespunzator, cu valorile din baza de date:
Attached File  ps_orders-new-columns-in-admin.png   40.45K   21 downloads

Mai am o mica problema, pe care nu reusesc sa o rezolv... Atunci cand dau click pe X-ul rosu sau pe V-ul verde, sa se modifice status-ul, asa cum se intampla, de exemplu, cu activarea/dezactivarea produselor. In momentul asta, la click, pagina se incarca din nou, dar nu se modifica nimic in baza de date...

Ceva idei? Unde sa ma uit, ce sa modific?

Multumesc!

#2
robbie_ro

robbie_ro

    Active Member

  • Grup: Members
  • Posts: 1,841
  • Înscris: 24.08.2004
Defineste campul nou adaugat si in clasa Order.php
public static $definition = array(
	 'table' => 'orders',
	 'primary' => 'id_order',
	 'fields' => array(
		 'id_address_delivery' =>	 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		 'id_address_invoice' =>	 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		 'id_cart' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		 'id_currency' =>			 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		 'id_shop_group' =>			 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		 'id_shop' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		 'id_lang' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		 'id_customer' =>			 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		 'id_carrier' =>			 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		 'current_state' =>			 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		 'secure_key' =>			 array('type' => self::TYPE_STRING, 'validate' => 'isMd5'),
		 'payment' =>				 array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
		 'module' =>				 array('type' => self::TYPE_STRING, 'validate' => 'isModuleName', 'required' => true),
		 'recyclable' =>			 array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
		 'gift' =>					 array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
		 'gift_message' =>			 array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
		 'mobile_theme' =>			 array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
		 'total_discounts' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_discounts_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_discounts_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_paid' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		 'total_paid_tax_incl' =>	 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_paid_tax_excl' =>	 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_paid_real' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		 'total_products' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		 'total_products_wt' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		 'total_shipping' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_shipping_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_shipping_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'carrier_tax_rate' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
		 'total_wrapping' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_wrapping_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'total_wrapping_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		 'round_mode' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		 'round_type' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		 'shipping_number' =>		 array('type' => self::TYPE_STRING, 'validate' => 'isTrackingNumber'),
		 'conversion_rate' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
		 'invoice_number' =>		 array('type' => self::TYPE_INT),
		 'delivery_number' =>		 array('type' => self::TYPE_INT),
		 'invoice_date' =>			 array('type' => self::TYPE_DATE),
		 'delivery_date' =>			 array('type' => self::TYPE_DATE),
		 'valid' =>					 array('type' => self::TYPE_BOOL),
		 'reference' =>				 array('type' => self::TYPE_STRING),
		 'date_add' =>				 array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
		 'date_upd' =>				 array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
		 'is_paid' =>					 array('type'=>self::TYPE_BOOL)
	


Edited by robbie_ro, 21 June 2017 - 09:38.


#3
h0tice

h0tice

    Member

  • Grup: Members
  • Posts: 379
  • Înscris: 21.03.2005

 robbie_ro, on 21 iunie 2017 - 09:36, said:

Defineste campul nou adaugat si in clasa Order.php

Multumesc de sfat. Din pacate nu s-a schimbat nimic dupa de l-am adaugat si in Order.php

#4
robbie_ro

robbie_ro

    Active Member

  • Grup: Members
  • Posts: 1,841
  • Înscris: 24.08.2004
'is_paid' => array(
		'title' => $this->l('Incasata'),
		'active' => 'statuspaid',
		'filter_key' => $alias.'!is_paid',
		'align' => 'text-center',
		'type' => 'bool',
		'class' => 'fixed-width-sm',
		'orderby' => false
   )



Unde ai definita variabila $alias?

Incearca
'is_paid' => array(
		'title' => $this->l('Incasata'),
		'align' => 'text-center',
		'type' => 'bool',
		'class' => 'fixed-width-sm',
		'orderby' => false
   )



#5
h0tice

h0tice

    Member

  • Grup: Members
  • Posts: 379
  • Înscris: 21.03.2005

 robbie_ro, on 21 iunie 2017 - 12:41, said:

Unde ai definita variabila $alias?
Eu nu am definit-o. Partea asta de cod am luat-o din AdminProductsController.php si am modificat-o. Initial era asa:
$this->fields_list['active'] = array(
			'title' => $this->l('Status'),
			'active' => 'status',
			'filter_key' => $alias.'!active',
			'align' => 'text-center',
			'type' => 'bool',
			'class' => 'fixed-width-sm',
			'orderby' => false
		);

 robbie_ro, on 21 iunie 2017 - 12:41, said:

Incearca
'is_paid' => array(
	 'title' => $this->l('Incasata'),
	 'align' => 'text-center',
	 'type' => 'bool',
	 'class' => 'fixed-width-sm',
	 'orderby' => false
)


Daca il las asa, in loc de X si V apare 1 si 0. Am adaugat si 'active' => 'statuspaid', dar tot nu face update.

#6
robbie_ro

robbie_ro

    Active Member

  • Grup: Members
  • Posts: 1,841
  • Înscris: 24.08.2004
Din ce am vazut rapid in Prestashop, in controllerul AdminProductsController ai o functie care modifica statusul produsului.
Cam aceeasi chestie trebuie sa faci in AdminOrdersController.
public function processStatus()
	{
		$this->loadObject(true);
		if (!Validate::isLoadedObject($this->object)) {
			return false;
		}
		if (($error = $this->object->validateFields(false, true)) !== true) {
			$this->errors[] = $error;
		}
		if (($error = $this->object->validateFieldsLang(false, true)) !== true) {
			$this->errors[] = $error;
		}
		if (count($this->errors)) {
			return false;
		}
		$res = parent::processStatus();
		$query = trim(Tools::getValue('bo_query'));
		$searchType = (int)Tools::getValue('bo_search_type');
		if ($query) {
			$this->redirect_after = preg_replace('/[\?|&](bo_query|bo_search_type)=([^&]*)/i', '', $this->redirect_after);
			$this->redirect_after .= '&bo_query='.$query.'&bo_search_type='.$searchType;
		}
		return $res;
	}



Anunturi

Chirurgia cranio-cerebrală minim invazivă Chirurgia cranio-cerebrală minim invazivă

Tehnicile minim invazive impun utilizarea unei tehnologii ultramoderne.

Endoscoapele operatorii de diverse tipuri, microscopul operator dedicat, neuronavigația, neuroelectrofiziologia, tehnicile avansate de anestezie, chirurgia cu pacientul treaz reprezintă armamentarium fără de care neurochirurgia prin "gaura cheii" nu ar fi posibilă. Folosind tehnicile de mai sus, tratăm un spectru larg de patologii cranio-cerebrale.

www.neurohope.ro

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Forumul Softpedia foloseste "cookies" pentru a imbunatati experienta utilizatorilor Accept
Pentru detalii si optiuni legate de cookies si datele personale, consultati Politica de utilizare cookies si Politica de confidentialitate