Recollir comandes d'OsCommerce
Video-tutorials: vídeos osCommerce
Aquest procés recull les dades dels clients i les seves comandes incorporant-les automàticament als arxius del software de gestió QFACWIN. Si marca la casella de validació Baixar només els clients, el programa permet baixar els clients o usuaris que tinguin comandes a la web sense baixar les comandes.
El programa marca les comandes processades (ja baixades) de manera que es poden seleccionar per recollir només les comandes pendents de processar.
També pot seleccionar les comandes a baixar per data i en aquest cas es baixaran totes les seleccionades s'hagin baixat o no.
Si la seva botiga ja conté dades, el procés d'instal·lació marca totes les comandes com a baixades ja que és possible que tingui comandes antigues emmagatzemades a la botiga que no vulgui descarregar en l'exercici actual. Si vol baixar-les totes haurà de seleccionar-les per data.
En activar el mòdul per gestionar 5 botigues d'Internet en aquesta pantalla es mostra un desplegable per seleccionar de quina botiga han de baixar les comandes. Trobarà informació sobre el mòdul al blog de QFACWIN.
Seleccioni les comandes a mostrar (pendents o des de data) i premi mostrar comandes. El programa processarà les comandes existents a la seva botiga i mostrarà les sol·licitades. Un cop mostrades, s'activa el botó d'incorporar comandes.
Comenci la incorporació prement el botó incorporar comandes.
El procés d'incorporació realitza les següents tasques:
Comprova que el client existeixi per NIF o, en defecte, per e-mail. Si el client no existeix, s'afegeix a l'arxiu de clients. Si ja existeix, es modifica actualitzant les següents dades:
- e-mail, telèfon i fax si els camps s'han omplert en la comanda i són diferents (els antics es graven a la pestanya Notes).
- omple el número de la targeta si és diferent i s'ha indicat un de nou (els números antics es graven a la pestanya Notes).
- compara les adreces de facturació i enviament amb les del client. Si no les troba, les afegeix.
S'insereix la comanda a l'arxiu de comandes, deixant-la llesta per traspassar a albarans o factures.
El programa recalcula la comanda i comprova que coincideixi amb el total de la comanda emesa a la botiga. En cas que no coincideixin, s'avisa al log de la diferència. Aquesta pot ser deguda a arrodoniments en càlculs amb molts decimals, a la no aplicació de l'IVA en despeses de transport degut a que s'hagin configurat com a suplerts, degut a que el client existent tingui o no la casella d'exempt d'IVA marcada, etc. Guardi i revisi el log per determinar i corregir les causes del desquadre.
Un cop incorporades, les comandes es marquen com a traspassades.
Durant el procés d'incorporació, es van escrivint en un log tots els detalls del mateix. Per configurar que el programa l'avisi interactivament amb un missatge per a cada detall rellevant conforme es vagin processant, marqui la casella Missatges interactius en baixar les comandes a la pestanya general de configuració.
IMPORTANT: Adaptacions per descarregar comandes amb atributs d'osCommerce i ZenCart. Adaptació per gravar les anotacions inicials del client a ZenCart.
- Adaptació per descarregar comandes amb atributs d'osCommerce
OsCommerce només guarda les descripcions de les propietats i atributs a la comanda però no els seus codis, de manera que en descarregar comandes, és molt difícil determinar exactament les propietats dels articles de la comanda. Ja que s'han de buscar per la descripció i podria confondre's amb una altra propietat.
Per resoldre això i que les propietats de les comandes puguin baixar-se correctament cal incorporar una petita modificació a l'arxiu checkout_process.php de la carpeta principal d'osCommerce. Si s'utilitza pagament per PayPal, cal fer la mateixa modificació a paypal_standard.php i en general a tots els scripts de pagament que substitueixin a checkout_process.php. Només es descarregaran correctament les comandes fetes després d'aplicar aquestes modificacions.
Buscar (aproximadament per la línia 215):
if (DOWNLOAD_ENABLED == 'true') {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
i substituir-lo per:
// qfacwin attributtes
if (DOWNLOAD_ENABLED == 'true') {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, pa.products_attributes_id
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
Buscar (aproximadament por la línia 220):
$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); */
i substituir-lo per:
// qfacwin attributtes
$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
//eof qfacwin attributes
i unes línies més avall:
Buscar:
$sql_data_array = array('orders_id' => $insert_id,
'orders_products_id' => $order_products_id,
'products_options' => $attributes_values['products_options_name'],
'products_options_values' => $attributes_values['products_options_values_name'],
'options_values_price' => $attributes_values['options_values_price'],
'price_prefix' => $attributes_values['price_prefix']);
i substituir-lo per:
$sql_data_array = array('orders_id' => $insert_id,
'orders_products_id' => $order_products_id,
'products_options' => $attributes_values['products_options_name'],
'products_options_values' => $attributes_values['products_options_values_name'],
'options_values_price' => $attributes_values['options_values_price'],
// qfacwin attributtes
'NIDATRIB' => $attributes_values['products_attributes_id'],
//eof qfacwin attributes
'price_prefix' => $attributes_values['price_prefix']);
Amb aquests canvis, es guarden els codis dels atributs a la comanda amb la qual cosa s'aconsegueix una identificació exacta dels atributs en el moment de descarregar les comandes.
Cal tenir en compte que només es descarregaran correctament les comandes fetes després d'aplicar aquestes modificacions.
- Contribució Grid Attributes:
Aquesta contribució permet treballar amb els atributs en mode taula (un o dos atributs per article) posant el primer atribut com a fila i el segon com a columnes. A més implementa el control d'estoc i els increments de preus.
Si té instal·lada aquesta contribució, cal marcar-ho a la pestanya contribucions del menú web-> osCommerce configurar. Cal tenir en compte que només es descarregaran correctament les comandes fetes després d'aplicar aquestes modificacions.
Per poder baixar correctament les comandes a aquesta contribució cal fer les següents modificacions a l'arxiu checkout_process.php de la botiga
Buscar (aproximadament línia 177)
// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
$sql_data_array = array('orders_id' => $insert_id,
'products_id' => tep_get_prid($order->products[$i]['id']),
'products_model' => $order->products[$i]['model'],
'products_name' => $order->products[$i]['name'],
$sql_data_array = array('orders_id' => $insert_id,
'products_id' => tep_get_prid($order->products[$i]['id']),
'products_model' => $order->products[$i]['model'],
'products_name' => $order->products[$i]['name'],
'products_price' => $order->products[$i]['price'],
'final_price' => $order->products[$i]['final_price'],
'products_tax' => $order->products[$i]['tax'],
'products_quantity' => $order->products[$i]['qty']);
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();
i substituir-lo per:
// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
//qfacwin grid attributes
$qgrid_query =tep_db_query("select v.CCODIVAL as CCODIVAL1, v.products_options_values_name as cnomval1, v2.CCODIVAL as CCODIVAL2, v2.products_options_values_name as cnomval2 from products_grid pg
left join products_options_values v on (v.products_options_values_id = pg.row_options_value_id and v.language_id = ". $languages_id . ")
left join products_options_values v2 on (v2.products_options_values_id = pg.col_options_value_id and v2.language_id = ". $languages_id . ") where products_grid_id =" . tep_get_grid($order->products[$i]['id'] ) );
$qgrid = tep_db_fetch_array($qgrid_query);
$qprop_query =tep_db_query("select p1.CCODIPROP as CCODIPROP1, p1.products_options_name as cnomprop1, p2.CCODIPROP as CCODIPROP2, p2.products_options_name as cnomprop2 from products_grid_row_col g
left join products_options p1 on (p1.products_options_id = row_head_id and p1.language_id = ". $languages_id . ")
left join products_options p2 on (p2.products_options_id = col_head_id and p2.language_id = ". $languages_id . ") where products_id = ". tep_get_prid($order->products[$i]['id']) );
$qprop = tep_db_fetch_array($qprop_query);
//end qfacwin grig attributes
$sql_data_array = array('orders_id' => $insert_id,
'products_id' => tep_get_prid($order->products[$i]['id']),
'products_model' => $order->products[$i]['model'],
'products_name' => $order->products[$i]['name'],
'products_price' => $order->products[$i]['price'],
'final_price' => $order->products[$i]['final_price'],
'products_tax' => $order->products[$i]['tax'],
//qfacwin grig attributes
'CCODIVAL1' => $qgrid['CCODIVAL1' ],
'CCODIPROP1' => $qprop['CCODIPROP1' ],
'CPROP1' => trim ( $qprop["cnomprop1"]) . ': '. trim ( $qgrid["cnomval1"]) ,
'CCODIVAL2' => $qgrid['CCODIVAL2' ],
'CCODIPROP2' => $qprop['CCODIPROP2' ],
'CPROP2' => trim ( $qprop["cnomprop2"]) . ': '. trim ( $qgrid["cnomval2"]) ,
//end qfacwin grig attributes
'products_quantity' => $order->products[$i]['qty']);
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();
- Adaptació per descarregar comandes amb atributs de ZenCart
ZenCart tampoc guarda els codis d'atributs, per la qual cosa al descarregar comandes, es fa molt difícil determinar exactament les propietats dels articles de la comanda, ja que cal buscar-los per la descripció i podria confondre's amb una altra propietat.
Per solucionar això i que les propietats de les comandes es puguin baixar correctament cal incorporar una petita modificació a l'arxiu carpeta /includes/classes/order.php :
Buscar (línia 771 aprox):
$attributes_query = "select popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix,
pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
pa.attributes_price_factor, pa.attributes_price_factor_offset,
pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
pa.attributes_price_words, pa.attributes_price_words_free,
pa.attributes_price_letters, pa.attributes_price_letters_free,
pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " .
TABLE_PRODUCTS_ATTRIBUTES . " pa
left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
on pa.products_attributes_id=pad.products_attributes_id
where pa.products_id = '" . zen_db_input($this->products[$i]['id']) . "'
and pa.options_id = '" . $this->products[$i]['attributes'][$j]['option_id'] . "'
and pa.options_id = popt.products_options_id
and pa.options_values_id = '" . $this->products[$i]['attributes'][$j]['value_id'] . "'
and pa.options_values_id = poval.products_options_values_id
and popt.language_id = '" . $_SESSION['languages_id'] . "'
and poval.language_id = '" . $_SESSION['languages_id'] . "'";
i substituir-lo per:
$attributes_query = "select popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix,
pa.products_attributes_id ,
pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
pa.attributes_price_factor, pa.attributes_price_factor_offset,
pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
pa.attributes_price_words, pa.attributes_price_words_free,
pa.attributes_price_letters, pa.attributes_price_letters_free,
pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " .
TABLE_PRODUCTS_ATTRIBUTES . " pa
left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
on pa.products_attributes_id=pad.products_attributes_id
where pa.products_id = '" . zen_db_input($this->products[$i]['id']) . "'
and pa.options_id = '" . $this->products[$i]['attributes'][$j]['option_id'] . "'
and pa.options_id = popt.products_options_id
and pa.options_values_id = '" . $this->products[$i]['attributes'][$j]['value_id'] . "'
and pa.options_values_id = poval.products_options_values_id
and popt.language_id = '" . $_SESSION['languages_id'] . "'
and poval.language_id = '" . $_SESSION['languages_id'] . "'";
Buscar (tres línies més avall):
$attributes_values = $db->Execute("select popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix,
pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
pa.attributes_price_factor, pa.attributes_price_factor_offset,
pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
pa.attributes_price_words, pa.attributes_price_words_free,
pa.attributes_price_letters, pa.attributes_price_letters_free
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
where pa.products_id = '" . $this->products[$i]['id'] . "' and pa.options_id = '" . (int)$this->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$this->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
i substituir-lo per:
$attributes_values = $db->Execute("select popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix,
pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
pa.products_attributes_id ,
pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
pa.attributes_price_factor, pa.attributes_price_factor_offset,
pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
pa.attributes_price_words, pa.attributes_price_words_free,
pa.attributes_price_letters, pa.attributes_price_letters_free
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
where pa.products_id = '" . $this->products[$i]['id'] . "' and pa.options_id = '" . (int)$this->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$this->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
Buscar (tres línies més avall):
$sql_data_array = array('orders_id' => $zf_insert_id,
'orders_products_id' => $order_products_id,
'products_options' => $attributes_values->fields['products_options_name'],
// 'products_options_values' => $attributes_values->fields['products_options_values_name'],
'products_options_values' => $this->products[$i]['attributes'][$j]['value'],
'options_values_price' => $attributes_values->fields['options_values_price'],
'price_prefix' => $attributes_values->fields['price_prefix'],
'product_attribute_is_free' => $attributes_values->fields['product_attribute_is_free'],
'products_attributes_weight' => $attributes_values->fields['products_attributes_weight'],
'products_attributes_weight_prefix' => $attributes_values->fields['products_attributes_weight_prefix'],
'attributes_discounted' => $attributes_values->fields['attributes_discounted'],
'attributes_price_base_included' => $attributes_values->fields['attributes_price_base_included'],
'attributes_price_onetime' => $attributes_values->fields['attributes_price_onetime'],
'attributes_price_factor' => $attributes_values->fields['attributes_price_factor'],
'attributes_price_factor_offset' => $attributes_values->fields['attributes_price_factor_offset'],
'attributes_price_factor_onetime' => $attributes_values->fields['attributes_price_factor_onetime'],
'attributes_price_factor_onetime_offset' => $attributes_values->fields['attributes_price_factor_onetime_offset'],
'attributes_qty_prices' => $attributes_values->fields['attributes_qty_prices'],
'attributes_qty_prices_onetime' => $attributes_values->fields['attributes_qty_prices_onetime'],
'attributes_price_words' => $attributes_values->fields['attributes_price_words'],
'attributes_price_words_free' => $attributes_values->fields['attributes_price_words_free'],
'attributes_price_letters' => $attributes_values->fields['attributes_price_letters'],
'attributes_price_letters_free' => $attributes_values->fields['attributes_price_letters_free'],
'products_options_id' => (int)$this->products[$i]['attributes'][$j]['option_id'],
'products_options_values_id' => (int)$this->products[$i]['attributes'][$j]['value_id'],
'products_prid' => $this->products[$i]['id']
);
i substituir-lo per:
$sql_data_array = array('orders_id' => $zf_insert_id,
'orders_products_id' => $order_products_id,
'products_options' => $attributes_values->fields['products_options_name'],
// 'products_options_values' => $attributes_values->fields['products_options_values_name'],
'products_options_values' => $this->products[$i]['attributes'][$j]['value'],
'options_values_price' => $attributes_values->fields['options_values_price'],
'price_prefix' => $attributes_values->fields['price_prefix'],
'product_attribute_is_free' => $attributes_values->fields['product_attribute_is_free'],
'products_attributes_weight' => $attributes_values->fields['products_attributes_weight'],
'products_attributes_weight_prefix' => $attributes_values->fields['products_attributes_weight_prefix'],
// qfacwin attributtes
'NIDATRIB' => $attributes_values->fields['products_attributes_id'],
//eof qfacwin attributes
'attributes_discounted' => $attributes_values->fields['attributes_discounted'],
'attributes_price_base_included' => $attributes_values->fields['attributes_price_base_included'],
'attributes_price_onetime' => $attributes_values->fields['attributes_price_onetime'],
'attributes_price_factor' => $attributes_values->fields['attributes_price_factor'],
'attributes_price_factor_offset' => $attributes_values->fields['attributes_price_factor_offset'],
'attributes_price_factor_onetime' => $attributes_values->fields['attributes_price_factor_onetime'],
'attributes_price_factor_onetime_offset' => $attributes_values->fields['attributes_price_factor_onetime_offset'],
'attributes_qty_prices' => $attributes_values->fields['attributes_qty_prices'],
'attributes_qty_prices_onetime' => $attributes_values->fields['attributes_qty_prices_onetime'],
'attributes_price_words' => $attributes_values->fields['attributes_price_words'],
'attributes_price_words_free' => $attributes_values->fields['attributes_price_words_free'],
'attributes_price_letters' => $attributes_values->fields['attributes_price_letters'],
'attributes_price_letters_free' => $attributes_values->fields['attributes_price_letters_free'],
'products_options_id' => (int)$this->products[$i]['attributes'][$j]['option_id'],
'products_options_values_id' => (int)$this->products[$i]['attributes'][$j]['value_id'],
'products_prid' => $this->products[$i]['id']
);
Amb aquests canvis, es guarden els codis dels atributs a la comanda, aconseguint una identificació exacta dels atributs en el moment de descarregar les comandes.
Cal tenir en compte que sóc només es descarregaran correctament les comandes realitzades després d'aplicar aquestes modificacions.
- Adaptació per enregistrar les anotacions inicials del client a ZenCart.
Al descarregar la comanda, es llegeixen les observacions de la comanda amb estat pendent (codi = 1) i es descarrega la primera. Es suposa que quan un client fa una comanda amb observacions, la que es grava del client és la primera i està en estat pendent. Això és així per evitar descarregar les anotacions de tramitació com a observacions de la comanda. En enregistrar la comanda, ZenCart posa les anotacions inicials del client (observacions) en el mateix estat que la comanda. Si, a causa de la forma de pagament, la comanda queda marcada com "en procés", les anotacions inicials del client també queden marcades "en procés" i no es descarreguen a QFACWIN. Per evitar-ho cal fer la següent modificació a /includes/classes/orders.php perquè, independentment de l'estat de la comanda, l'anotació inicial quedi sempre amb estat 1= Pendent.
Buscar (línia 650 aprox.):
$sql_data_array = array('orders_id' => $insert_id,
'orders_status_id' => $this->info['order_status'],
'date_added' => 'now()',
'customer_notified' => $customer_notification,
'comments' => $this->info['comments']);
i substituir-ho per:
$sql_data_array = array('orders_id' => $insert_id,
//QFACWIN estat anotació del client sempre = 1 'orders_status_id' => $this->info['order_status'],
'orders_status_id' => '1',
'date_added' => 'now()',
'customer_notified' => $customer_notification,
'comments' => $this->info['comments']);
Temes relacionats:
Video-tutorials: vídeos osCommerceActualitzar botiga
Importar dades d'osCommerce a QFACWIN
Configurar integració amb OsCommerce