nnikolaj Posted March 5, 2007 Share Posted March 5, 2007 I have been looking for a contribution or an edit, that could help me add 'This product will be in stock on ...' from the product_info.php page to the product listing page. I want this text... (or a new, shorter text) added to the product list (where I, in this picture, have drawn a red box) The language is Danish, but in English it says: "This product will be in stock on ..." I have a multilanguage site, så the text add must work i diffrent languages. Hopefully someone can help. Maybe an answer to this question could leed to a new contribution. /Nikolaj Link to comment Share on other sites More sharing options...
Velveeta Posted March 5, 2007 Share Posted March 5, 2007 I have been looking for a contribution or an edit, that could help me add 'This product will be in stock on ...' from the product_info.php page to the product listing page.I want this text... (or a new, shorter text) added to the product list (where I, in this picture, have drawn a red box) The language is Danish, but in English it says: "This product will be in stock on ..." I have a multilanguage site, så the text add must work i diffrent languages. Hopefully someone can help. Maybe an answer to this question could leed to a new contribution. /Nikolaj You'll have to find all of the queries that lead to a product_listing, and add the products_date_available field to them (if it's not already in them)... I believe these are just in the index.php, and advanced_search.php files (I might be thinking of advanced_search_results.php)... Then, in the product listing, just add that field's value to the output, wherever you want it to display at, if the date is in the future... To make it multi-language compatible, you'll need to declare something like "TEXT_PRODUCTS_EXPECTED" in your english.php, danish.php, etc files and use that value instead of a plain text entry in the file itself... Richard. Richard Lindsey Link to comment Share on other sites More sharing options...
nnikolaj Posted March 6, 2007 Author Share Posted March 6, 2007 You'll have to find all of the queries that lead to a product_listing, and add the products_date_available field to them (if it's not already in them)... I believe these are just in the index.php, and advanced_search.php files (I might be thinking of advanced_search_results.php)... Then, in the product listing, just add that field's value to the output, wherever you want it to display at, if the date is in the future... To make it multi-language compatible, you'll need to declare something like "TEXT_PRODUCTS_EXPECTED" in your english.php, danish.php, etc files and use that value instead of a plain text entry in the file itself... Richard. Thanks for the answer quick answer. But I am still not sure, what to do. Could you please give an example or show me how to do it? I would realy appreciate that. /Nikolaj Link to comment Share on other sites More sharing options...
khime Posted March 6, 2007 Share Posted March 6, 2007 You need to retrieve the expected date from the database in whilst in index.php then put the information in the correct column in includes/modules/product_listing.php In index.php look for all instances of $ $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, etc. I think theres 4 of them. add "p.products_date_available," without the quotes somewhere in the middle of these, maybe after p.products_price, In product_listing.php look for switch ($column_list[$col]) { I'm not sure where you want to put the information, maybe after product model? In that case look for case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; break; change to: case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; $lc_text = $lc_text.TEXT_DATE_AVAILABLE.tep_date_long($listing['products_date_available']); break; I think this should work, let me know if wrong Link to comment Share on other sites More sharing options...
nnikolaj Posted March 6, 2007 Author Share Posted March 6, 2007 You need to retrieve the expected date from the database in whilst in index.php then put the information in the correct column in includes/modules/product_listing.php In index.php look for all instances of $ $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, etc. I think theres 4 of them. add "p.products_date_available," without the quotes somewhere in the middle of these, maybe after p.products_price, In product_listing.php look for switch ($column_list[$col]) { I'm not sure where you want to put the information, maybe after product model? In that case look for case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; break; change to: case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; $lc_text = $lc_text.TEXT_DATE_AVAILABLE.tep_date_long($listing['products_date_available']); break; I think this should work, let me know if wrong Thank you for your support untill now, khime. This works great and I have put it in the 'product name' column, but it does not hide the text defined in danish.php and english.php. Here is a picture: It shows the date as it should on the specifik products but the text always show... So now the question is: How kan I hide the text in the product list and only show it on the products that are expected to arraive? /Nikolaj Link to comment Share on other sites More sharing options...
Velveeta Posted March 6, 2007 Share Posted March 6, 2007 Thank you for your support untill now, khime. This works great and I have put it in the 'product name' column, but it does not hide the text defined in danish.php and english.php. Here is a picture: It shows the date as it should on the specifik products but the text always show... So now the question is: How kan I hide the text in the product list and only show it on the products that are expected to arraive? /Nikolaj Put a check on it like this: if ($listing['products_date_available'] > date("Y-m-d H:i:s")) { <put the language code here> } This will check to see if the date available is in the future, and only then will it add that text... Richard. Richard Lindsey Link to comment Share on other sites More sharing options...
nnikolaj Posted March 7, 2007 Author Share Posted March 7, 2007 Put a check on it like this: if ($listing['products_date_available'] > date("Y-m-d H:i:s")) { <put the language code here> } This will check to see if the date available is in the future, and only then will it add that text... Richard. This was exactly what I needed. Thank you so much! (All of you guys) Now it show the text and date as it should, but there is still one more little thing. I have defined the text in danish.php and english.php to be red, but the date is still black. How do I change the date to appear in red? Also, how do I define the text size on both the date and the text to be smaller than the size of the product name? I think 1 or 2 px smaller would be great! /Nikolaj Link to comment Share on other sites More sharing options...
Velveeta Posted March 8, 2007 Share Posted March 8, 2007 This was exactly what I needed. Thank you so much! (All of you guys) Now it show the text and date as it should, but there is still one more little thing. I have defined the text in danish.php and english.php to be red, but the date is still black. How do I change the date to appear in red? Also, how do I define the text size on both the date and the text to be smaller than the size of the product name? I think 1 or 2 px smaller would be great! /Nikolaj Try structuring your text defines in english and danish.php to be something like this (modify to your own liking, but add the %s): define('TEXT_PRODUCT_EXPECTED', '<span class="justAlittleSmaller">This product is expected on %s</span>'); Then, in your code where you add the date expected, do it like this: <?php echo sprintf(TEXT_PRODUCT_EXPECTED, $listing['products_date_available']); ?> This will insert that date output into the %s portion of that TEXT_PRODUCT_EXPECTED entry, and being wrapped in the span tag, the date should have the same color and formatting as the "This product is expected on" text... Then you just create an entry in your stylesheet.css file to define that new class "justAlittleSmaller" (or whatever you want to name that class, just make sure it matches the span tag's class) and make it color: red and make the size just a little smaller than the size for the smallText class (or whatever the td container's class is set to)... Richard. Richard Lindsey Link to comment Share on other sites More sharing options...
nnikolaj Posted March 13, 2007 Author Share Posted March 13, 2007 Try structuring your text defines in english and danish.php to be something like this (modify to your own liking, but add the %s): define('TEXT_PRODUCT_EXPECTED', '<span class="justAlittleSmaller">This product is expected on %s</span>'); Then, in your code where you add the date expected, do it like this: <?php echo sprintf(TEXT_PRODUCT_EXPECTED, $listing['products_date_available']); ?> This will insert that date output into the %s portion of that TEXT_PRODUCT_EXPECTED entry, and being wrapped in the span tag, the date should have the same color and formatting as the "This product is expected on" text... Then you just create an entry in your stylesheet.css file to define that new class "justAlittleSmaller" (or whatever you want to name that class, just make sure it matches the span tag's class) and make it color: red and make the size just a little smaller than the size for the smallText class (or whatever the td container's class is set to)... Richard. Hi Richard. Thank you again for your answer. :thumbsup: I have been away this weekend and did not see your answer before now. I have tried to implement this code in all kinds om ways, but I constantly get this error: Parse error: syntax error, unexpected '<' in .../catalog/includes/modules/product_listing.php on line 119 The code in the product_listing.php looks like this: if ($listing['products_date_available'] > date("Y-m-d H:i:s")) { $lc_text = $lc_text.TEXT_DATE_EXPECTED.tep_date_short($listing['products_date_available']); } else { } break; I would be pleased if you could specify where to put the code? /Nikolaj Link to comment Share on other sites More sharing options...
Velveeta Posted March 13, 2007 Share Posted March 13, 2007 Do it like this: if ($listing['products_date_available'] > date("Y-m-d H:i:s")) { // $lc_text = $lc_text.TEXT_DATE_EXPECTED.tep_date_short($listing['products_date_available']); $lc_text .= sprintf(TEXT_DATE_EXPECTED, tep_date_short($listing['products_date_available'])); } else { } break; Richard. Richard Lindsey Link to comment Share on other sites More sharing options...
nnikolaj Posted March 13, 2007 Author Share Posted March 13, 2007 Do it like this: if ($listing['products_date_available'] > date("Y-m-d H:i:s")) { // $lc_text = $lc_text.TEXT_DATE_EXPECTED.tep_date_short($listing['products_date_available']); $lc_text .= sprintf(TEXT_DATE_EXPECTED, tep_date_short($listing['products_date_available'])); } else { } break; Richard. That was just perfect! ... And of course... I messed around with the PHP-tag in a new table :-" . But now I have learned something new. Thank you so much for all your help. That was brilliant! :lol: /Nikolaj Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.