Modified Shop - Aktionspreise

Antworten

Modified Shop - Aktionspreise

Hallo,

Werden eigentlich die Aktionspreise mit in den Shop übertragen?
Liebe Grüße aus Österreich
Christian

https://www.akustik-projekt.at

Re: Modified Shop - Aktionspreise

Gruß Thomas
------------------------------------------------

installierte Erweiterungen

*** Auftragsbearbeitung, Shop Auftrag, Stapelbuchung, Stapeldruck, Teilrechnungen, Preisupdate


*** MySQL 4.1.22 local
*** Parallels Desktop 12 # 2 x 2,8 GHz Intel Core i7 # 16,0 GB RAM

Re: Modified Shop - Aktionspreise

Danke Thomas,

Werd mal schauen, ob ich das hin bekomme.
Liebe Grüße aus Österreich
Christian

https://www.akustik-projekt.at

Re: Modified Shop - Aktionspreise

Hallo,

Habs jetzt probiert in der Schnittstelle zu ändern. Dort gibt es eine Funktion "ProductsSpecialPriceUpdate" und "ProductsSpecialPriceErase".
Ich habe die Tags dort jetzt geändert, allerdings ohne Erfolg. Werden diese Funktionen von CAO verwendet?
Nachfolgend der Code der beiden Funktionen.

Code: Alles auswählen

function ProductsSpecialPriceUpdate ()
{
  global $_POST;

  $ProdID  = xtc_db_prepare_input($_POST['pID']);

  $Price  = xtc_db_prepare_input($_POST['products_ac_price']);
  $Status = xtc_db_prepare_input($_POST['status']);
  $Expire = xtc_db_prepare_input($_POST['products_ac_date_to']);

  if (isset($ProdID))
  {
    /*
    1. Ermitteln ob Produkt bereits einen Spezialpreis hat
    2. wenn JA -> Update / NEIN -> INSERT
    */
    $sp_sql = "select specials_id from " . TABLE_SPECIALS . " " .
              "where products_id='" . (int)$ProdID . "'";
    $sp_query = xtc_db_query($sql);

    if ($sp = xtc_db_fetch_array($sp_query))
    {
      // es existiert bereits ein Datensatz -> Update
      $SpecialID = $sp['specials_id'];

      xtc_db_query(
              "update " . TABLE_SPECIALS .
              " set specials_new_products_price = '" . $Price . "'," .
              " specials_last_modified = now()," .
              " expires_date = '" . $Expire .
              "' where specials_id = '" . (int)$SpecialID. "'");

      print_xml_status (0, $_POST['action'], 'OK', 'UPDATE', '', '');
    }
      else
    {
      // Neuanlage
      xtc_db_query(
              "insert into " . TABLE_SPECIALS .
              " (products_id, specials_new_products_price, specials_date_added, expires_date, status) " .
              " values ('" . (int)$ProdID . "', '" . $Price . "', now(), '" . $Expire . "', '1')");

      print_xml_status (0, $_POST['action'], 'OK', 'APPEND', '', '');
    }
  }
    else
  {
    print_xml_status (99, $_POST['action'], 'PARAMETER ERROR', '', '', '');
  }
}

Code: Alles auswählen

function ProductsSpecialPriceErase ()
{
  global $_POST;

  $ProdID  = xtc_db_prepare_input($_POST['prodid']);
  if (isset($ProdID))
  {
    xtc_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . (int)$ProdID . "'");
    print_xml_status (0, $_POST['action'], 'OK', '', '', '');
  }
    else
  {
    print_xml_status (99, $_POST['action'], 'PARAMETER ERROR', '', '', '');
  }
}
Danke schon im vorhinein
Liebe Grüße aus Österreich
Christian

https://www.akustik-projekt.at

Re: Modified Shop - Aktionspreise

Hi,

ich habe damals die Funktion angepasst um die Sonderpreis Felder aus CAO zu nutzen.

Code: Alles auswählen

function ProductsSpecialPriceUpdate ($ProdID)
//BURN alles irgendwie verändert
{
	global $_POST;
    $Price = xtc_db_prepare_input($_POST['products_ac_price']);
	
	$Expire = xtc_db_prepare_input($_POST['products_ac_date_to']);

	if ($Expire > 0) {
		$Expire_dd = substr($Expire,0,2);
		$Expire_mm = substr($Expire,3,2); 
		$Expire_yyyy = substr($Expire,6,4); 
		$Expire = mktime(0,0,0,$Expire_mm,$Expire_dd,$Expire_yyyy);
		$Expire = $Expire + 86400;

		if ($Expire > time()) {

			$Expire = date('Y-m-d', $Expire);
  
			if (isset($ProdID))
			{
				/*
				1. Ermitteln ob Produkt bereits einen Spezialpreis hat
				2. wenn JA -> Update / NEIN -> INSERT		    
				*/
				$sp_sql = "select specials_id from " . TABLE_SPECIALS . " " .
					"where products_id='" . (int)$ProdID . "'";
				$sp_query = xtc_db_query($sp_sql);
		                 
				if ($sp = xtc_db_fetch_array($sp_query)) {
					// es existiert bereits ein Datensatz -> Update
					$SpecialID = $sp['specials_id'];
           
					xtc_db_query(
						"update " . TABLE_SPECIALS . 
						" set specials_new_products_price = '" . $Price . "'," .
						" specials_last_modified = now()," . 
						" status = 1," .
						" expires_date = '" . $Expire .
						"' where specials_id = '" . (int)$SpecialID. "'");
            
					//print_xml_status (0, $_POST['action'], 'OK', 'UPDATE', '', '');
				} else {
					// Neuanlage
					xtc_db_query(
						"insert into " . TABLE_SPECIALS .
						" (products_id, specials_new_products_price, specials_date_added, expires_date, status) " .
						" values ('" . (int)$ProdID . "', '" . $Price . "', now(), '" . $Expire . "', '1')");
						//print_xml_status (0, $_POST['action'], 'OK', 'APPEND', '', '');
				}
			} else {
				//  print_xml_status (99, $_POST['action'], 'PARAMETER ERROR', '', '', '');
			}
		} else {
			xtc_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . (int)$ProdID . "'");
		}

	} else {
		xtc_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . (int)$ProdID . "'");
	}
}
so sollte es klappen ;)
Die Um im Adminbereich vom Shop nicht irgendwann 1000 abgelaufene Sonderangebote zu haben wird bei jedem Update die Gültigkeit geprüft. Falls abgelaufen wird das Angebot gelöscht.

Re: Modified Shop - Aktionspreise

Hallo Benjamin,

Danke für Deine Hilfe, aber damit werden die Aktionspreise auch nicht mit übertragen. Muss ich vielleicht noch irgendwelche anderen Einstellungen, zB. in CAO, vornehmen? Ich hab jetzt probiert deine Funktion in die Funktion "ProductsUpdate" einzubauen, da funktionierts.
Liebe Grüße aus Österreich
Christian

https://www.akustik-projekt.at

Re: Modified Shop - Aktionspreise

Hi,

hab da etwas vergessen. die Funktion von oben muss mit

Code: Alles auswählen

ProductsSpecialPriceUpdate($products_id);
noch aufgerufen werden.

Einfach die eine Zeile am Ende von "function ProductsUpdate ()" vor

Code: Alles auswählen

if (file_exists('cao_produpd_2.php')) { include('cao_produpd_2.php'); }
einfügen.

Gruß