Modificare Automatic Customer Stock Update Notification

Questo forum è dedicato alle discussioni riguardanti le contribution per osCommerce

Moderatore: mod Generali

Rispondi
loris_ripa
membro Veteran
membro Veteran
Messaggi: 937
Iscritto il: 21/03/2004, 1:00
Località: Italia
Contatta:

Modificare Automatic Customer Stock Update Notification

Messaggio da loris_ripa »

Ho installato questa contibution:

http://addons.oscommerce.com/info/3152

Praticamente quando aggiorno la quantità di un prodotto esaurito dall'admin, cliccando su aggiorna la termine della procedura di modifica prodotto chi ha selezionato la notifica per il prodotto riceve l'avviso che il prodotto è nuovamente disponibile.
Fin qui tutto ok, adesso però con il modulo di collegamento easyfatt/oscommerce la contribution ovviamente non potrà funzionare.
Come faccio a creare un bottone "Invia avvisi disponibilità" nella pagina categorie così da fare l'operazione 1/2 volte al giorno?
Il codice della contribution è:

Codice: Seleziona tutto

// Begin Automatic Customer Stock Update Notification

		  if ($HTTP_POST_VARS['products_quantity'] > 0){			

			$audience = array();

			$products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in ( '" . (int)$products_id . "')");			

		  while ($products = tep_db_fetch_array($products_query)) {
			$audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'],
                                                         'lastname' => $products['customers_lastname'],
                                                         'email_address' => $products['customers_email_address']);
		  }		  
		  
		    $product_query_raw = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");	  
		    $product = tep_db_fetch_array($product_query_raw);
			
			$customers_query_raw = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in ( '" . (int)$products_id . "')");
			$customer = tep_db_fetch_array($customers_query_raw);			

			$mimemessage = new email(array('X-Mailer: osCommerce System Mailer'));
			$mimemessage->add_text('Stock Update: ' . $product['products_name'] . ' - Model [ '. $product['products_model'] . ' ]' . "\n\n" . 'Dear ' . $customer['customers_firstname'] . ' ' . $customer['customers_lastname'] . ',' . "\n" . 'According to your ' . STORE_NAME . ' Product Notifications request ... We wish to inform you that ' . '' . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'product_info.php' . '?products_id=' . $products_id . '">' . $product['products_name'] . '</a>' . ' is now in stock.'  . "\n" . 'Please visit' . ' ' . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . STORE_NAME . '</a>' . ' if you would like to make a purchase. Thank you for your continued support!');
			$mimemessage->build_message();

		  reset($audience);
		  while (list($key, $value) = each ($audience)) {
		    $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, 'Now In Stock - Your requested product notification for ' . $product['products_name'], $email_order);

			tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . "  where products_id = '" . $products_id . "' ");
			}
		  }
// End Automatic Customer Stock Update Notification
La versione originale prevede che questo codice venga inserito in admin/categories.php esattamente qui:

Codice: Seleziona tutto

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
          } elseif ($action == 'update_product') {
Un grazie a tutti.
:D :D :D
loris_ripa
membro Veteran
membro Veteran
Messaggi: 937
Iscritto il: 21/03/2004, 1:00
Località: Italia
Contatta:

Messaggio da loris_ripa »

Immaginavo che il mio quesito non fosse facile...
Comunque sto facendo un po' di tentativi...se qualcuno vuole venire in mio soccorso fatemi un fischio...
:D :D :D
Rispondi