zoobzen
-
Posts
9 -
Joined
-
Last visited
Never
Posts posted by zoobzen
-
-
Very nice Andy ..
I tried both "isset" and "empty" by themselves .. so I guess I was on the right track .. but as usual the experts dialed right in ..
Thanks Andy .. you da' man
Respectfuly,
Frank
-
Hello,
You did not mention Smarty, but just in case you do consider itr .. don't. I am locked into a situation where it has to be used and I can tell you that it is "garbage" IMHO ..
Frank
-
Hello,
I have an interesting problem to solve ..
I am setting up a few radio buttons to establish a new or returning user. Using the below code I am getting the buttons to act the way I want them to, however, when no button is selected (I cannot have any "pre-selected" for this app) I get an "Undefined index: userType" error in addition to my own error message to the user. The "mUserTypes" array is what I am using to load the radio buttons, and my "selected" value is mNeworReturn[user_type].
Thanks for any help offered .. Frank
$this->mNeworReturn = array('user_type' => ' ');
$this->mUserTypes = array ('New' => 'I am a first time customer, 'Return' => 'I am a returning customer');
if (isset ($_POST['Login']))
{
$this->mNeworReturn['user_type'] = $_POST['userType'];
if (empty ($_POST['userType']))
{
$this->mUserTypeError = 1;
$this->_mErrors++
}
}
If needed to review this problem, the below is the whole constructor of the class .. Thanks
class CheckoutStep1
{
// Public stuff
public $mErrorMessage;
public $mLinkToLogin;
public $mLinkToRegisterCustomer;
public $mEmail = '';
public $mNeworReturn;
public $mUserTypes;
public $mUserTypeError;
public $mUserError;
private $_mErrors = 0;
// Class constructor
public function __construct()
{
if (USE_SSL == 'yes' && getenv('HTTPS') != 'on')
$this->mLinkToLogin =
Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI')),
'https');
else
$this->mLinkToLogin =
Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI')));
$this->mLinkToStep2 = Link::ToRegisterCustomer();
$this->mNeworReturn = array('user_type' => '');
$this->mUserTypes = array ('New' => 'I am a first time customer',
'Return' => 'I am a returning customer');
if (isset($_POST['Login']))
{
$this->mNeworReturn['user_type'] = $_POST['userType'];
if (empty ($_POST['userType']))
{
$this->mUserTypeError = 1;
$this->_mErrors++;
}
}
}
-
I solved my problem by using a table join and sub query in mySQL in order to eliminate the mProdCat variable that was giving me trouble. It is more efficient anyway, but I sure wonder what I was doing wrong with this .. Thanks anyway ..
Frank
-
Something else interesting here, when I run the following code:
$this->mProdCat = Catalog::GetCategoryByProduct($this->_mProductId);
if (array_key_exists('category_id', $this->mProdCat))
$this->$mProdSelect =
(int)$this->mProdCat['category_id'];
else
trigger_error('CategoryId not set');
$this->mProdCat reads back as the term Array in my browser .. when I run the query manually:
SELECT category_id
FROM product_category
WHERE product_id = inProductId;
I get the expected result under category_id
Can anyone offer anything?
Thanks ..
Frank
-
I have tried casting the result as an int after this statement (becasue this->mProductSize requires an int) but same result. I am a real noob and I suspect that I may need additional processing since mProdCat is a variable (should only contain one number). I do not need to do anything with mProductSize though and it returns a much larger array.
Any suggestions on how I may "process further"? I have tried giving mProductSize things like mProdCat[0] and mprodCat['category_id'] to no avail.
Thanks .. Frank
-
This is the varibale that is giving the problem..
$this->mProdCat = (int)Catalog::GetCategoryByProduct($this->_mProductId);
I am using the return of this as the variable input to the following ..
$this->mProductSize = Catalog::GetProdsByCategory($this->mProdCat);
I have read (and reread) my typing and verified my typing. and I am still only getting as return of the value 1 from this->ProdCat I am stumped..
Thanks for the interest ..
Frank
-
Hello,
I am a real noob here and I am pulling my hair out over this problem ..
I have a variable defined and I am only able to get a 1 or 0 value when calling it .. it is only one line, and interestingly, other just like it are working fine. Here is the line ..
$this->mProdCat = (int)Catalog::GetCategoryByProduct($this->_mProductId);
it is inside a function that is calling to the following ..
// Retrieves category id from product id
public static function GetCategoryByProduct($productId)
{
// Build SQL query
$sql = 'CALL catalog_get_category_by_product(:product_id)';
// Build the parameters array
$params = array (':product_id' => $productId);
// Execute the query and return the results
return DatabaseHandler::GetAll($sql, $params);
}
Finally, this is how I am using it ..
$this->mProductSize = Catalog::GetProdsByCategory($this->mProdCat);
Everything seems to be doing what it should except since I get this value of 1 (with varified data), I don't populate the list with the proper data .. This is probably easy for the experts, but me .. well ... Thanks for any help offered ..
Need help understanding symbols ..
in PHP Coding Help
Posted
I need some help understanding the below syntax (the ? and the colon are throwing me)
isset($_POST['cardType']) ? $_POST['cardType'] : '';
Thanks for any help on this ..
Frank