Hack Virtuemart - editointi hinnat tavaroiden luettelo tavaroista

Hack varten VirtueMart, jonka ansiosta näytön mukaan kenttä muokata luettelon tavaran hinnasta. Välilehti tuotettujen tavaroiden taulukon sarakkeen otsikon hinnat on 2 ikonit - muokata ja tallentaa. Kun napsautat Muokkaa-kuvake näkyy ennen näkymätön teksti laatikot hinnat. Kun valitset Tallenna tiedot näiden alojen AJAX lähetetään palvelimelle

 administrator / components / com_virtuemart / html / product.product_list.php 
Pp. 42

Lisää she_edit_price - Näyttää / piilottaa tekstiä muokata kentän hinnalla klikkaat Muokkaa sarakkeen hintojen she_save_price - Ajax säästävä toiminto hinnat. Tiedot kaikkien alojen valitaan ja lähetetään hinnat palvelimelle (tiedosto jalostetut) administrator / fi / VirtueMart / html / product.ajax_tools.php (tapaus "shesaveprices":)

 $ Doc = & JFactory:: getDocument ();
$ Script = "
    var SHE_HIDE_INPUTS = 1;
    toiminto she_edit_price () {

	  näyttö = (SHE_HIDE_INPUTS)? "Block": "Ei ole";
	  Ext.get (Ext.query ('. She_input ")). SetStyle (" näyttö ", näyttö);
	  SHE_HIDE_INPUTS = 1-SHE_HIDE_INPUTS; 
    }
    toiminto she_save_price () {	

	    
	    var params = {};

	    var she_inputs = Ext.query ('. she_input ");
	    Ext.each (she_inputs, toiminto (kohde indeksi) {
		params ['params [' + item.getAttribute ('rel')+']'] = item.value;
	    });

	    var soittopyynnön = {
		menestys: toiminto (o) {			
			Ext.Msg.alert ("Hinnat on tallennettu", o.responseText);
		}
		vika: toiminto (o) {
			Ext.Msg.alert ("Virhe!", "Hinnat ei ole tallennettu");
		}
	    };
	    
	    Ext.Ajax.request ({menetelmä: "post", url: menestys: callback.success, vika: callback.failure, params: params});

    } ";
$ Doc-> addScriptDeclaration ($ script);

$ Doc-> addScriptDeclaration ($ script); 

Pp. 295

Korvata

/ / Nämä ovat saraakkeiden
$ Sarakkeet = array ('#' =>'',
				"" => ""
				$ VM_LANG-> _ ('PHPSHOP_PRODUCT_LIST_NAME') => "width = " 30%  ""
				$ VM_LANG-> _ ('VM_PRODUCT_LIST_MEDIA') => 'width = "5%" "
				$ VM_LANG-> _ ('PHPSHOP_PRODUCT_LIST_SKU') => "width = " 15%  ""
				$ VM_LANG-> _ ('PHPSHOP_PRODUCT_PRICE_TITLE') => "width = " 10%  ""
				$ VM_LANG-> _ ('PHPSHOP_CATEGORY') => "width = " 15%  "");

To: otsikon taulukon hintoihin lisätä kaksi kuvakkeet - Voit tallentaa ja muokata

 $ Price_adds = "> href =" javascript: void (null) "onclick =" she_edit_price () "> <img src =" ". JURI:: root ()." Kuvat / M_images / edit.png "alt = "Muokkaa" /> </ a>
	     <a href="javascript::void(null)" onclick="she_save_price()"> <img style = "width: 16px" alt = "Tallenna" src = "". JURI:: root (). "images / save_f2.png "/> </ a> ';

/ / Nämä ovat saraakkeiden
$ Sarakkeet = array ('#' =>'',
				"<input Type="checkbox" name="toggle" value="" onclick="checkAll(".$num_rows.")" />" => ""
				$ VM_LANG-> _ ('PHPSHOP_PRODUCT_LIST_NAME') => "width = " 30%  ""
				$ VM_LANG-> _ ('VM_PRODUCT_LIST_MEDIA') => 'width = "5%" "
				$ VM_LANG-> _ ('PHPSHOP_PRODUCT_LIST_SKU') => "width = " 15%  ""
				$ VM_LANG-> _ ('PHPSHOP_PRODUCT_PRICE_TITLE'). $ Price_adds => "width = " 10%  ""
				$ VM_LANG-> _ ('PHPSHOP_CATEGORY') => "width = " 15%  "");

Pp. 330

Korvata

 $ Tmp_cell = '<span class="editable priceform"> ". $ Globals [' CURRENCY_DISPLAY '] -> getValue ($ hinta [' product_price']).' ". $ Hinta ['product_currency'];
$ Tmp_cell .= '</ span>';

$ ListObj-<addCell( $tmp_cell,'id="'.$db-> f ("product_id').'" onclick =" showPriceForm (this.id) "title ="'.$ VM_LANG-> _ (' PHPSHOP_PRICE_FORM_LBL').'"');

To:

solussa ja hinnat lisätty tekstikehys hinta näytetä muokkauskenttään

 $ Tmp_cell = '<span onclick="showPriceForm('.$db-> f ("product_id').')" class =" muokattavissa priceform ">'.$ Globals [' CURRENCY_DISPLAY '] -> getValue ($ hinta [ "product_price']).' ". $ Hinta ['product_currency'];
$ Tmp_cell .= '</ span>
	      <div class="she_div">
		<input value="'.$price['product_price'].'" id="she_input'.$db-> f ("product_id').'" suht ="'.$ db-> f ('product_id" ). "class =" she_input "style =" display: none "/>
	      </ Div> ';

$ ListObj-> addCell ($ tmp_cell, "id ="'.$ db-> f ('product_id').'" Otsikko ="'.$ VM_LANG-> _ (' PHPSHOP_PRICE_FORM_LBL').'"');
 administrator / components / com_virtuemart / html / product.product_list.php 

Kun linja 155 (tauko) Lisää:

kaikki tekstikentät kanssa hintoihin tiedot siirretään assosiatiivisia joukko params (avain - arvo kentän "product_id", arvo - kentän arvo "product_price 'table # __ {vm} _product_price)

 case 'shesaveprices ":
$ Parametrit = vmGet ($ _REQUEST, 'params ");
 
$ Db = uusi ps_DB;
 
foreach ($ params kuin $ product_id => $ hinta) {
$ Q = "UPDATE # __ {VM} _product_price SET product_price ='".$ hinta." "Jos product_id ='".$ product_id ."'";
$ Db-> query ($ q);
}
 
echo 'hinnat ovat tallennus onnistui ";
break; 

Yhteys

518 4067
220 5532

ICQ 255018290

info@redsoft.ru

 

 

Redsoft-участник top25 рейтинга рунета

Redsoft - участник Top25
рейтинга студий России