Guest Posted June 20, 2003 Posted June 20, 2003 Hello, I've been modding the checkout procedure, as i found that it was to long. I've been able to bring it back to two pages, with as third page the confirmation. I only got stuck on the next part. during checkout, you must give in a shipping method. That is where I'm stuck. Since i've got only one shipping method, i wanted that my customers didn't have to select the shipping method, but have it posted in a hidden field. Only what values must i pass, so that it's correct registerd. Is it enough if i only pass the value "shipping=flat_flat " or must i pass the id's for the shipping. If i must pass the id's, how can i find the correct id's? Another problem i've come upon is that i only want to display a link to product_details.php if the field 'products_description' in the tabel 'products_description' is not empty. using PhpMyAdmin the following query works: select products_id, products_description from catalog.products_description where products_description = '' I've created the following query + array for in the file products_listing.php: //check if the product has a description $product_description_query = tep_db_query('select products_id, products_description from products_description where products_id =' . $listing_values['products_id']); $product_description = tep_fetch_array($products_description_query); Then i have a if statement to check if products_description is empty. If it is, it uses the first statement, otherwise the other. if ($product_description['products_description'] == '') { case 'PRODUCT_LIST_DESCRIPTION': $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . '</a> '; break; } else { case 'PRODUCT_LIST_DESCRIPTION': $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'info.gif', 'meer info') . '</a> '; break; } But that doesn't seem to work. Either php or mysql is ended by windows. I'm not a expert with php + mysql, and haven't got a clue what is wrong. Any help would be welcome.
Guest Posted June 23, 2003 Posted June 23, 2003 Well, i'm almost finished. I only have one problem left. i read at mysql.com that a text field always has space. How can i now check if it has no value, or that is has. If tried it with if (empty($listinvalues['pd.productsdescription'])) if ($listingvalues['pd.productsdescription']) if (isset($listinvalues['pd.productsdescription'])) but it always shows an image infront of all the products or no image at all. It must only show an image if there is a productsdescription.
Guest Posted June 23, 2003 Posted June 23, 2003 if ($listingvalues['pd.productsdescription'] = null);
Guest Posted June 23, 2003 Posted June 23, 2003 Tried it, and doesn't work. It contains a space by default in the DB, so it always returns false. that's also my problem.
Guest Posted June 23, 2003 Posted June 23, 2003 hmmmm... ok if (strlen($listingvalues['pd.productsdescription'] < 2));
Guest Posted June 23, 2003 Posted June 23, 2003 Just tried it. but now i get my image nowhere. this is the complete code i have now: case 'PRODUCT_LIST_DESCRIPTION': if (strlen($listingvalues['pd.productsdescription'] < 2)) { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . '</a> '; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'info.gif', 'meer info') . '</a> '; } break; I don't see anything what could be wrong.
Guest Posted June 23, 2003 Posted June 23, 2003 Sorry... I have been pasting what you posted before.... should be: if (strlen($listingvalues['pd.products_description'] < 2)) {
Guest Posted June 23, 2003 Posted June 23, 2003 Sorry... I have been pasting what you posted before.... should be: No prob, i should learn reading before copy -> paste :D very strange, but doesn't work. Also doesn't work with: <= == => i'm clueless :?
Wizzud Posted June 23, 2003 Posted June 23, 2003 You've got a bracket in the wrong place guys! Should be if (strlen($listingvalues['pd.products_description']) < 2) { Just a suggestion but an alternative might be to use trim() ... ? if (trim($listingvalues['pd.products_description']) = '' { Regards, Wizzud "It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."
Guest Posted June 23, 2003 Posted June 23, 2003 thanks wizzud. but still no succes. current code case 'PRODUCT_LIST_DESCRIPTION': if (strlen($listingvalues['pd.products_description']) < 2) { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . '</a> '; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'info.gif', 'meer info') . '</a> '; } break; Trim doesn't work, php goes down on my server. Shall upload and try it.
Guest Posted June 23, 2003 Posted June 23, 2003 Sorry... its 12:40 am here and I'm a bit too bleary to get thru your code... It should work using strlen.... you could try str_word_count
Guest Posted June 24, 2003 Posted June 24, 2003 Well, just installed the new php version (was working with an old one on my test server), but it still doesn't work. I get or an image in front of all products or get no image atall.
Guest Posted June 30, 2003 Posted June 30, 2003 Ok, got it working. It seems that i had to remove the " pd. " in $listing_values(pd.products_description).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.