Jump to content

Atributre Name - Attribute ID umwandeln


WEBAllrounder

Recommended Posts

Hallo

 

habe folgendes Problem. Kurz erklärt, ich möchte für Arikelmerkmale/Attribute kein Dropdown nutzen, sondern ein input Feld. In diesem input Feld kann der Kunde sein Merkmal eintragen und bekommt dazu den Preis angezeigt.

 

Der Kunde bekommt vorab einen Hinweis auf der Artikeldetailseite angezeigt,

das er ab 100g eintragen kann (Standartvariante), und dann in 10 schritte weiter gehen kann.

Trägt er zb. 125 ein, wird angezeigt dass diese Variante nicht zur Verfügung steht.

 

Soweit alles ok, habe das so gelöst:

 

input Feld zum eingeben der Mermale

g: <input type="text" value="" onkeyup="javascript:findCombination();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">

Funktion auf der product.js

function findCombination(firstTime)
{
    $('#minimal_quantity_wanted_p').fadeOut();
    $('#quantity_wanted').val(1);
    //create a temporary 'choice' array containing the choices of the customer
    var choice = new Array();
    $('div#attributes input').each(function(){
        choice.push($(this).val());   
      }); 

mein Problem. Das funktoniert nur, wenn ich Atribute_id eintrage.

 

Beispiel

 

Atribute Name 120 = Attribute Id 55

 

trage ich 120 ein, wird angezeigt...das nicht vorhanden. Trage ich die Attribute_id dazu ein, also die 55, wird der Preis dazu angezeigt.

 

wie kann ich das erreichen, dass wenn der Kunde 120 einträgt, im Hintergrund bzw in der product.js die Attribute_id abgefragt wird (eventuell mit einem hidden Feld?)

 

Meine Idee in der product.js:

function findCombination(firstTime)
{
    $('#minimal_quantity_wanted_p').fadeOut();
    $('#quantity_wanted').val(1);
    //create a temporary 'choice' array containing the choices of the customer
    var choice = new Array();
    $('div#attributes input').each(function(){
        choice.push($(this).val());

  //Abfrage der attribute_id = attribute_name
   if ($(this).val() == "120")
    {
      //$(this).val(55);
   combinations[combination]['idsAttributes'] = '55';
    }
       
      }); 

funktioniert aber nicht denn dann wird im input feld nach eingeben der "120" die 55 eingetragen!

 

Daher sich das nie wieder ändern wird (Attribute), könnte ich eine Abfrage einbauen welche besagt....wenn Kunde "120" einträgt, ist das die Attribute_id 55

 

komme da nicht weiter :(

 

hat jemand lust mir da zu helfen bzw einen Ansatz zu bieten

 

gruss

WEBAllrounder

Edited by WEBAllrounder (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...