Post by pablich » Thu May 08, 2014 8:52 pm

Hi, im trying to get de Customer group ID in this file:

catalog/model/catalog/obtendatos.php

Code: Select all

<?php
require_once('../../../config.php');
require_once(DIR_SYSTEM . 'startup.php');
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$q=$_GET["q"];
$resultado = mysql_query("SELECT * FROM product WHERE model LIKE '%" . $q . "%'");
while($row = mysql_fetch_array($resultado))
  {
 $special_query = mysql_query("SELECT * FROM product_special WHERE product_id LIKE '%" . $row['product_id'] . "%' AND customer_group_id LIKE '%" . $this->customer->getCustomerGroupId . "%'");
 $row_s = mysql_fetch_array($special_query);
if ($row['quantity'] > 0) {
$disponible = 7;
$stock_query = mysql_query("SELECT * FROM stock_status WHERE stock_status_id LIKE '%" . $disponible . "%'");
$stock = mysql_fetch_array($stock_query);
$rstock = $stock['name'];
}
if ($row['price']) { 
echo '<div class="price">';      
 if (!$row_s['price']) { 
echo '<span>';
echo 'Precio: ';
echo '</span>'; 
echo $row['price']; 
} else { 
echo '<span>';
echo 'Precio: ';
echo '</span>';
echo '<span class="price-new">';
echo $row_s['price'];
echo '</span>';
} 
echo '</div>';
 } 
echo '<div class="actions">';
echo '<div class="cart">';
 if ($row['price']) { 
echo $rstock; 
echo '<br>';
 } 

 echo 'Cantidad: ';
 echo '<input type="text" name="quantity" value="" class="input-mini" id="quantity-'.$row['product_id'].'">';
 if ($rstock !== "Sin disponibilidad") { 
echo '<br><input id="boton" name="boton" type="button" value="Añadir a la cesta" onclick="addQtyToCart(';
echo "'";
echo $row['product_id'];
echo "'";
echo ');" class="btn btn-cart btn-small" />';
 } 
echo '</div>';
echo '</div>';
}
?>
$this->customer->getCustomerGroupId NOT FOUND. Can someone help me? Thanks you!!
Last edited by Johnathan on Thu May 08, 2014 9:50 pm, edited 1 time in total.
Reason: Added [code] tags for readability

New member

Posts

Joined
Thu Feb 13, 2014 12:26 am

Post by MarketInSG » Sun May 11, 2014 1:04 pm

$this->customer->getCustomerGroupId() is the correct way. You're missing the brackets at the end..


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by pablich » Mon May 12, 2014 11:57 am

MarketInSG wrote:$this->customer->getCustomerGroupId() is the correct way. You're missing the brackets at the end..
Yes, i try, but show that error: $this is a invalid argument

New member

Posts

Joined
Thu Feb 13, 2014 12:26 am

Post by MarketInSG » Mon May 12, 2014 5:19 pm

just realised you aren't writing this in OOP. Then of course it wouldn't work. Look into how the model files are written, and how the controller files are written.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by pablich » Mon May 12, 2014 8:28 pm

MarketInSG wrote:just realised you aren't writing this in OOP. Then of course it wouldn't work. Look into how the model files are written, and how the controller files are written.
This is because I use this file in:

function showUser(str,num){
if (str==""){
document.getElementById("cargarproducto"+num).innerHTML="";
return;
}
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("cargarproducto"+num).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","catalog/model/catalog/id.php?q="+str,true);
xmlhttp.send();
}

New member

Posts

Joined
Thu Feb 13, 2014 12:26 am

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore
Who is online

Users browsing this forum: No registered users and 6 guests