Forums / General Questions / Adding Date Available with a message to items that will be sold...

Adding Date Available with a message to items that will be sold...

Views: 2,855

Results 1 to 20 of 33
17 Apr 2013, 1:08 AM
#1
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Adding Date Available with a message to items that will be sold...

Hi All,

Most of our items are in stock but there are instances where we sell items on 'Pre-Order' or 'Pre-Sale' bases, right now we had our items pages modified where the Available Date is further out, the system shows 'Pre-Order' but does show In Stock when Available Date Field left blank.

Here are the two link for our web site:

http://www.aydincoins.com/buy-silver/silver-rounds
http://www.aydincoins.com/buy-silver/silver-rounds/20-1-oz-silver-buffalo-round-coin-999-20-troy-ounce-fine-silver

if you notice it says 'Pre-Order', I would like to modify the code to add the following message in red font:

"This item will begin shipping on (Available Date Field).
Orders containing this item will not ship until this item is available."

how can I show the above message on the two pages I included here but only on items that are Pre-Order.

The message should NOT display when the Available Date Field is blank or before today's date.

Thank you

17 Apr 2013, 1:31 AM
#2
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

You will have to post a section of code from /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

Zen stock code does what you are asking for just worded differently.

In the above file look for something that looks like this:

<!--bof Product date added/available-->
<?php
  if ($products_date_available > date('Y-m-d H:i:s')) {
    if ($flag_show_product_info_date_available == 1) {
?>
  <p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p>
<?php
    }
  } else {
    if ($flag_show_product_info_date_added == 1) {
?>
      <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p>
<?php
    } // $flag_show_product_info_date_added
  }
?>
<!--eof Product date added/available -->
17 Apr 2013, 1:42 AM
#3
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

I am sorry but I didn't get what you said but here is the file below, what's the code to add the message, thank you.

tpl_product_info_display.php
PHP script text

<?php /** * Page Template * * Loaded automatically by index.php?main_page=product_info.<br /> * Displays details of a typical product * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_product_info_display.php 16242 2010-05-08 16:05:40Z ajeh $ */ //require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php'); ?> <div class="centerColumn" id="productGeneral"> <!--bof Form start--> <?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product', $request_type), 'post', 'enctype="multipart/form-data"') . "\n"; ?> <!--eof Form start--> <?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?> <!--bof Category Icon --> <?php if ($module_show_categories != 0) {?> <?php /** * display the category icons */ require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?> <?php } ?> <!--eof Category Icon --> <!--bof Prev/Next top position --> <?php if (PRODUCT_INFO_PREVIOUS_NEXT == 1 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?> <?php /** * display the product previous/next helper */ require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?> <?php } ?> <!--eof Prev/Next top position--> <!--bof Product Name--> <h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1> <!--eof Product Name--> <div id="product-left"> <center> <!--bof Main Product Image --> <?php if (zen_not_null($products_image)) { ?> <?php /** * display the main product image */ require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?> <?php } ?> <!--eof Main Product Image--> <br class="clearBoth" /> </center> <!--bof Additional Product Images --> <?php /** * display the products additional images */ require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php'); ?> <!--eof Additional Product Images --> </div> <div id="product-right"> <!--bof Reviews button and count--> <?php if ($flag_show_product_info_reviews == 1) { // if more than 0 reviews, then show reviews button; otherwise, show the "write review" button if ($reviews->fields['count'] > 0 ) { ?> <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">Read the Reviews</a>'; ?></div> <?php echo '<div class="reviewCount"><span class="reviews-text">'; if ($flag_show_product_info_reviews_count == 1) { echo TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong></span>'; $stars_image_suffix = str_replace('.', '_', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc. $average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2); echo TEXT_CURRENT_REVIEWS_RATING . '' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $stars_image_suffix . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating)); } else { echo ''; } echo '</div>'; ?> <?php } else { ?> <br class="clearBoth" /> <div id="productReviewLink1" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">Write a Review for this Product</a>'; ?></div> <br class="clearBoth" /> <?php } } ?> <!--eof Reviews button and count --> <!--bof Product details list --> <?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?> <div id="productDetailsList"> <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '' . TEXT_PRODUCT_MODEL . $products_model . '' : '') . "\n"; ?> <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '>' . TEXT_PRODUCT_WEIGHT . $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '' : '') . "\n"; ?> <?php if ($products_date_available > date('Y-m-d H:i:s')) { echo (($flag_show_product_info_quantity == 1) ? 'Pre-Order' : '') . "\n"; }else{ echo (($flag_show_product_info_quantity == 1) ? '' . ($products_quantity > 0 ? TEXT_PRODUCT_IN_STOCK : TEXT_PRODUCT_NOT_IN_STOCK) . '' : '') . "\n"; } ?> <!--<?php echo (($flag_show_product_info_quantity == 1) ? '' . ($products_quantity > 0 ? TEXT_PRODUCT_IN_STOCK : TEXT_PRODUCT_NOT_IN_STOCK) . '' : '') . "\n"; ?>--> <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '' : '') . "\n"; ?> </div> <br class="clearBoth" /> <?php } ?> <!--eof Product details list --> <br class="clearBoth" /> <div id="back-instock"> <?php // BEGIN CEON BACK IN STOCK NOTIFICATIONS 1 of 2 if (!is_null($product_back_in_stock_notification_form_link)) { echo '<p>' . $product_back_in_stock_notification_form_link . '</p>'; } // END CEON BACK IN STOCK NOTIFICATIONS 1 of 2 ?> </div> <br class="clearBoth" /> <!--bof Product Price block --> <h2 id="productPrices" class="productGeneral"> <?php // base price if ($show_onetime_charges_description == 'true') { $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />'; } else { $one_time = ''; } echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']); ?></h2> <!--eof Product Price block --> <!--bof Product Price block --> <h2 id="productPrices" class="productGeneral"> <?php // base price //if ($show_onetime_charges_description == 'true') { //$one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />'; //} else { //$one_time = ''; //} //$cheapest = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000); //$cheapest = '$' . number_format($cheapest, 2); //$price = zen_get_products_actual_price((int)$_GET['products_id']); //$price = '$' . number_format($price, 2);

if ( $cheapest != $price && ( !stristr($price,"productSpecialPrice") ) && ( !stristr($price,"call_for_prices") ) ) {
echo 'Volume Pricing from: ' . $cheapest . '';
}
else {
echo $price;
}

?></h2>

<!--eof Product Price block --> <!--bof Product Reward Points block --> <h2 id="productRewardPoints" class="productRewardPoints"> <?php /** * display the product reward points */ include($template->get_template_dir('/tpl_product_reward_points.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_product_reward_points.php'); ?> </h2> <!--eof Product Reward Points block --> <center> <!--bof Quantity Discounts table --> <?php if ($products_discount_type != 0) { ?> <?php /** * display the products quantity discount */ require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php'); ?> <?php } ?> <!--eof Quantity Discounts table --> </center> <!--bof Attributes Module --> <?php if ($pr_attr->fields['total'] > 0) { ?> <?php /** * display the product atributes */ require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php'); ?> <?php } ?> <!--eof Attributes Module --> <!--bof free ship icon --> <?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?> <div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div> <?php } ?> <!--eof free ship icon --> <br class="clearBoth" /> <!--bof Add to Cart Box --> <?php if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') { // do nothing } else { ?>
        <?php
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
        if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
          // hide the quantity box and default to 1
          $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
        } else {
          // show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
        }
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);

?>

<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
  echo $display_qty;
  echo $display_button;
        ?>
      </div>
<?php } // display qty and button ?> <?php } // CUSTOMERS_APPROVAL == 3 ?> <!--eof Add to Cart Box--> <br class="clearBoth" /> <!--bof Ask a Question --> <div id="productQuestions" class="biggerText">

<b><?php echo '<a href="' . zen_href_link(FILENAME_ASK_A_QUESTION, 'products_id=' . $_GET['products_id']) . '"><img src="includes/templates/ayd/images/ask-question.png" /></a>'; ?></b>

</div> <!--eof Ask a Question--> </div> <br class="clearBoth" /> <!--bof Product date added/available--> <?php if ($products_date_available > date('Y-m-d H:i:s')) { if ($flag_show_product_info_date_available == 1) { ?> <p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p> <?php } } else { if ($flag_show_product_info_date_added == 1) { ?> <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p> <?php } // $flag_show_product_info_date_added } ?> <!--eof Product date added/available --> <?php if ($products_date_available > date('Y-m-d H:i:s')) { echo (($flag_show_product_info_quantity == 1) ? '<img src="includes/templates/ayd/images/pre-order.jpg" class="pre-order-image" />' : '') . "\n"; } ?> <br class="clearBoth" /> <!--bof Product description --> <?php if ($products_description != '') { ?> <div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div> <?php } ?> <!--eof Product description --> <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style"> <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a> <a class="addthis_button_tweet"></a> <a class="addthis_counter addthis_pill_style"></a> </div> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4cd1ec2b08cdcb12"></script> <!-- AddThis Button END --> <br class="clearBoth" /> <!--bof Prev/Next bottom position --> <?php if (PRODUCT_INFO_PREVIOUS_NEXT == 2 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?> <?php /** * display the product previous/next helper */ require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?> <?php } ?> <!--eof Prev/Next bottom position --> <!--bof Product date added/available--> <?php if ($products_date_available > date('Y-m-d H:i:s')) { if ($flag_show_product_info_date_available == 1) { ?> <p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p> <?php } } else { if ($flag_show_product_info_date_added == 1) { ?> <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p> <?php } // $flag_show_product_info_date_added } ?> <!--eof Product date added/available --> <!--bof Product URL --> <?php if (zen_not_null($products_url)) { if ($flag_show_product_info_url == 1) { ?>
<p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php } // $flag_show_product_info_url } ?> <!--eof Product URL --> <!--bof Cross Sell --> <!--bof also purchased products module--> <?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');?> <!--eof also purchased products module--> <!--eof Cross Sell --> <?php require($template->get_template_dir('tpl_modules_xsell_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_xsell_products.php'); ?> <!--bof Form close--> </form> <!--bof Form close--> <?php // BEGIN CEON BACK IN STOCK NOTIFICATIONS 2 of 2 if (isset($back_in_stock_notification_build_form) && $back_in_stock_notification_build_form) { // Build the notification request form

/**

  • Load the template class
    */
    require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'class.CeonXHTMLHiTemplate.php');

// Load in and extract the template parts for Back In Stock Notification functionality
$bisn_template_filename = $template->get_template_dir('inc.html.back_in_stock_notifications.html',
DIR_WS_TEMPLATE, $current_page_base, 'templates') . '/' .
'inc.html.back_in_stock_notifications.html';

$bisn_template = new CeonXHTMLHiTemplate($bisn_template_filename);

$bisn_template_parts = $bisn_template->extractTemplateParts();

$back_in_stock_notification_form = new CeonXHTMLHiTemplate;

// Load in the source for the form
$back_in_stock_notification_form->setXHTMLSource(
$bisn_template_parts['PRODUCT_INFO_BACK_IN_STOCK_NOTIFICATION_FORM']);

// Add the form action, titles, labels and button
$form_start_tag = zen_draw_form('back_in_stock_notification',
zen_href_link(FILENAME_BACK_IN_STOCK_NOTIFICATION_SUBSCRIBE, zen_get_all_get_params(),
$request_type), 'POST');

$back_in_stock_notification_form->setVariable('back_in_stock_notification_form_start_tag',
$form_start_tag);

$product_back_in_stock_notification_form_title = BACK_IN_STOCK_NOTIFICATION_TEXT_FORM_TITLE;

$back_in_stock_notification_form->setVariable('title',
$product_back_in_stock_notification_form_title);

$name_label = BACK_IN_STOCK_NOTIFICATION_TEXT_FORM_ENTRY_NAME;
$email_label = BACK_IN_STOCK_NOTIFICATION_TEXT_FORM_ENTRY_EMAIL;
$email_confirmation_label = BACK_IN_STOCK_NOTIFICATION_TEXT_FORM_ENTRY_CONFIRM_EMAIL;

$back_in_stock_notification_form->setVariable('name_label', $name_label);
$back_in_stock_notification_form->setVariable('email_label', $email_label);
$back_in_stock_notification_form->setVariable('email_confirmation_label',
$email_confirmation_label);

$submit_button = zen_image_submit(BUTTON_IMAGE_NOTIFY_ME, BUTTON_NOTIFY_ME_ALT,
'class="notify-me" name="notify_me"');
$back_in_stock_notification_form->setVariable('submit_button', $submit_button);

// Add in the introductory text
$intro_text = sprintf(BACK_IN_STOCK_NOTIFICATION_TEXT_FORM_INTRO,
htmlentities($products_name, ENT_COMPAT, CHARSET));
$notice_text = BACK_IN_STOCK_NOTIFICATION_TEXT_FORM_NOTICE;

$back_in_stock_notification_form->setVariable('intro', $intro_text);
$back_in_stock_notification_form->setVariable('notice', $notice_text);

// Add the customer's details to the form (empty unless logged in)
$back_in_stock_notification_form->setVariable('name',
$back_in_stock_notification_form_customer_name);
$back_in_stock_notification_form->setVariable('email',
$back_in_stock_notification_form_customer_email);
$back_in_stock_notification_form->setVariable('cofnospam',
$back_in_stock_notification_form_customer_email_confirmation);

print $back_in_stock_notification_form->getXHTMLSource();
}
// END CEON BACK IN STOCK NOTIFICATIONS 2 of 2 ?>

</div>

rbarbour:

You will have to post a section of code from /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

Zen stock code does what you are asking for just worded differently.

In the above file look for something that looks like this:

<!--bof Product date added/available--> <?php if ($products_date_available > date('Y-m-d H:i:s')) { if ($flag_show_product_info_date_available == 1) { ?> <p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p> <?php } } else { if ($flag_show_product_info_date_added == 1) { ?> <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p> <?php } // $flag_show_product_info_date_added } ?> <!--eof Product date added/available --> ```
17 Apr 2013, 2:08 AM
#4
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

find:

<?php
if ($products_date_available > date('Y-m-d H:i:s')) {
  echo (($flag_show_product_info_quantity == 1) ? 'Pre-Order'  : '') . "\n"; 
 }else{
 echo (($flag_show_product_info_quantity == 1) ? ''  .  ($products_quantity > 0 ? TEXT_PRODUCT_IN_STOCK :  TEXT_PRODUCT_NOT_IN_STOCK) . '' : '') . "\n";
}
?>

change to:

<?php
if ($products_date_available > date('Y-m-d H:i:s')) {
echo (($flag_show_product_info_quantity == 1) ? TEXT_PRE_ORDER_BOF . zen_date_long($products_date_available) . TEXT_PRE_ORDER_EOF . '<br/>Pre-Order' : '') . "\n";
}else{
echo (($flag_show_product_info_quantity == 1) ? '' . ($products_quantity > 0 ? TEXT_PRODUCT_IN_STOCK : TEXT_PRODUCT_NOT_IN_STOCK) . '' : '') . "\n";
}
?>

create a file called: product_info_extras.php in /includes/languages/english/extra_definitions/YOUR_TEMPLATE_NAME

add the following code to product_info_extras.php

<?php
/**
 *
 * @copyright Copyright 2013 rbarbour - ZCadditions
 * @license http://www.gnu.org/licenses/ GNU Public License V3.0
 * /includes/languages/english/extra_definitions/YOUR_TEMPLATE_NAME/product_info_extras.php
 */
 
define('TEXT_PRE_ORDER_BOF','<font color="red">This item will begin shipping on (');
define('TEXT_PRE_ORDER_EOF','). Orders containing this item will not ship until this item is available.</font>');

?>

That's it

17 Apr 2013, 3:19 AM
#5
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

I really appreciate your help, it worked perfectly but how can I show the same message on this page also:

http://www.aydincoins.com/buy-silver/silver-rounds

17 Apr 2013, 3:35 AM
#6
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

The code for that page is in /includes/modules/YOUR_TEMPLATE_NAME/product_listing.php

This code will differ from the previous.

17 Apr 2013, 3:54 AM
#7
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

got it, the file is too long paste it in this message but I think I found the part that needs to be changed, I thank you again, here is the part that needs to be changed.

// qty box with add to cart button
if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
$lc_button= zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
} else {
$lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
}
}
}
$the_button = $lc_button;
$products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
$lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
$lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
// bof: add date available
$products_date_available = zen_products_lookup($listing->fields['products_id'], 'products_date_available');

if ($products_date_available > date('Y-m-d H:i:s')) {

      $lc_text .= '<br /><div class="pl-shipping">' . 'Pre Order</div>';

}elseif ($listing->fields['products_quantity'] > 0){

$lc_text .= '<br />' . '<div class="pl-shipping">In Stock<br />Ships in 1 - 3 Business Days</div>';

}else{
$lc_text .= '<br />' . '<div class="pl-shipping">Out of Stock</div>';

}

// eof: add date available

rbarbour:

The code for that page is in /includes/modules/YOUR_TEMPLATE_NAME/product_listing.php

This code will differ from the previous.

17 Apr 2013, 4:19 AM
#8
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

just replace

$lc_text .= '<br /><div class="pl-shipping">' . 'Pre Order</div>';

with:

$lc_text .= '<br /><div class="pl-shipping">' . TEXT_PRE_ORDER_BOF . zen_date_long($products_date_available) . TEXT_PRE_ORDER_EOF . '<br/>Pre-Order</div>';
17 Apr 2013, 4:36 AM
#9
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

it works but looks like the height of the cell needs to be adjusted, any idea how to fix it, http://www.aydincoins.com/buy-silver/silver-rounds

thank you

rbarbour:

just replace

$lc_text .= '<br /><div class="pl-shipping">' . 'Pre Order</div>';

> 
> with:
> ```php
$lc_text .= '<br /><div class="pl-shipping">' . TEXT_PRE_ORDER_BOF . zen_date_long($products_date_available) . TEXT_PRE_ORDER_EOF . '<br/>Pre-Order</div>';
17 Apr 2013, 4:48 AM
#10
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

in stylesheet.css

find
.pl-shipping{margin-top:105px;width:200px;line-height:22px;margin-left:-205px;}

change to
.pl-shipping{margin-top:105px;width:220px;line-height:11px;margin-left:-205px;}

17 Apr 2013, 5:03 AM
#11
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

Worked perfectly, thank you for your help, just curious if I have more changes you would be willing to help me? I don't mind paying for your services, let me know if you are interested.

thank you, getting late, perhaps we could talk tomorrow.

rbarbour:

in stylesheet.css

find
.pl-shipping{margin-top:105px;width:200px;line-height:22px;margin-left:-205px;}

change to
.pl-shipping{margin-top:105px;width:220px;line-height:11px;margin-left:-205px;}

17 Apr 2013, 7:22 PM
#12
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

Thank you for your help, one more request, how can I add the 'Write Review' or Read the Reviews link next to the stars on this page: http://www.aydincoins.com/buy-silver/silver-rounds it only shows the stars, below is the code I think for the stars:

// I've adapted the following table style from my custom tpl_modules_product_quantity_discounts, I've made it more vertical to make it fit better, if you want the original horizontal layout you can find the code in tpl_modules_product_quantity_discounts

//NB the TEXT_HEADER below is for ACTUAL PRICE DISCOUNTS it could be replaced with the alternatives: TEXT_HEADER_DISCOUNT_PRICES_AMOUNT_OFF or TEXT_HEADER_DISCOUNT_PRICES_PERCENTAGE.

$lc_text = '<center><table class="pl-qd-table" cellspacing="0" cellpadding="3">

<tr style="background: #ECF8FD; font-weight: bold"> <!--<td colspan="2" align="center">Quantity Price</font></td> </tr>--> <tr><td align="left">' . $show_qty . '</td><td>' . $currencies->display_price($show_price, zen_get_tax_rate($products_tax_class_id)) . '</td></tr> <tr><td align="left">' . $discount_level_1['show_qty'] . '</td><td>' . $currencies->display_price($discount_level_1['discounted_price'], zen_get_tax_rate($products_tax_class_id)) . '</td></tr> <tr><td align="left">'. $discount_level_2['show_qty'] . '</td><td>' . $currencies->display_price($discount_level_2['discounted_price'], zen_get_tax_rate($products_tax_class_id)) .'</td></tr> <tr><td align="left">'. $discount_level_3['show_qty'] . '</td><td>' . $currencies->display_price($discount_level_3['discounted_price'], zen_get_tax_rate($products_tax_class_id)) .'</td></tr> <tr><td align="left">'. $discount_level_4['show_qty'] . '</td><td>' . $currencies->display_price($discount_level_4['discounted_price'], zen_get_tax_rate($products_tax_class_id)) .'</td></tr> <!--<tr><td align="left">'. $discount_level_5['show_qty'] . '</td><td>' . $currencies->display_price($discount_level_5['discounted_price'], zen_get_tax_rate($products_tax_class_id)) .'</td></tr>--></table></center>' ;

} else {
$lc_text ='<div class="no-qd"></div>';
}
break;

    case 'PRODUCT_LIST_NAME':
    $lc_align = '';
       if (isset($_GET['manufacturers_id'])) {
      $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
    } else {
      $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div><center><div class="product_detail"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' .zen_image_button(BUTTON_IMAGE_GOTO_PROD_DETAILS , BUTTON_GOTO_PROD_DETAILS_ALT).'</a></div></center><div id="askQuestion" class="biggerText"><a href="' . zen_href_link(FILENAME_ASK_A_QUESTION, 'products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_ASK_A_QUESTION, BUTTON_ASK_A_QUESTION_ALT) . '</a></div>';

// 2P added BOF - Average Product Rating
$reviews_query = "select count(*) as count from " . TABLE_REVIEWS . " r, "
. TABLE_REVIEWS_DESCRIPTION . " rd
where r.products_id = '" . (int)$listing->fields['products_id'] . "'
and r.reviews_id = rd.reviews_id
and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
$review_status;

$reviews = $db->Execute($reviews_query);
$reviews_average_rating_query = "select avg(reviews_rating) as average_rating from " . TABLE_REVIEWS . " r, "
                                                   . TABLE_REVIEWS_DESCRIPTION . " rd
                   where r.products_id = '" . (int)$listing->fields['products_id'] . "'
                   and r.reviews_id = rd.reviews_id
                   and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
                   $review_status;

$reviews_average_rating = $db->Execute($reviews_average_rating_query);
// 2P added EOF - Average Product Rating

if ($reviews->fields['count'] > 0 ) {
//$lc_text .= TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />';
$stars_image_suffix = str_replace('.', '', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc.
$average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
$lc_text .= '<div class="stars-rating">' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars
' . $stars_image_suffix . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating)) . '</div>';

     }}
    break;




    case 'PRODUCT_LIST_MANUFACTURER':
    $lc_align = '';
    $lc_text = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>';
    break;
    case 'PRODUCT_LIST_PRICE':

$our_new_variable = zen_products_lookup($listing->fields['products_id'], $what_field = 'products_discount_type');

if ($our_new_variable == 1) {

    $lc_price = '<div class="pl-price1" style="position:relative;left:150px;top:10px;">' . zen_get_products_display_price($listing->fields['products_id']) . '</div><br />';

}

else {

    $lc_price = '<div class="pl-price">' . zen_get_products_display_price($listing->fields['products_id']) . '</div><br />';

}
$lc_align = 'right';
$lc_text = $lc_price;

    // more info in place of buy now
    $lc_button = '';
    if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
      $lc_button = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
    } else {
      if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
        if (
            // not a hide qty box product
            $listing->fields['products_qty_box_status'] != 0 &&
            // product type can be added to cart
            zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N'
            &&
            // product is not call for price
            $listing->fields['product_is_call'] == 0
            &&
            // product is in stock or customers may add it to cart anyway
            ($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0) ) {
          $how_many++;
        }
        // hide quantity box
        if ($listing->fields['products_qty_box_status'] == 0) {
          $lc_button = 'hello<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
        } else {

if ($our_new_variable >= 2) {
$lc_button = '<div class="pl-input" style="position:relative;top:170px;left:170px;">' . TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type="text" name="products_id[" . $listing->fields['products_id'] . "]" value="0" size="4" /></div>";

}
else {
$lc_button = '<div class="pl-input1">' . TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type="text" name="products_id[" . $listing->fields['products_id'] . "]" value="0" size="4" /></div>";

}
}

      } else {

// qty box with add to cart button
if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
$lc_button= zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
} else {
$lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
}
}
}
$the_button = $lc_button;
$products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
$lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
$lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
// bof: add date available
$products_date_available = zen_products_lookup($listing->fields['products_id'], 'products_date_available');

if ($products_date_available > date('Y-m-d H:i:s')) {

      $lc_text .= '<br /><div class="pl-shipping">' . TEXT_PRE_ORDER_BOF . zen_date_long($products_date_available) . TEXT_PRE_ORDER_EOF . '<br/><br/>Pre-Order</div>';      

}elseif ($listing->fields['products_quantity'] > 0){

$lc_text .= '<br />' . '<div class="pl-shipping">In Stock<br />Ships in 1 - 3 Business Days</div>';

}else{
$lc_text .= '<br />' . '<div class="pl-shipping">Out of Stock</div>';

}

rbarbour:

in stylesheet.css

find
.pl-shipping{margin-top:105px;width:200px;line-height:22px;margin-left:-205px;}

change to
.pl-shipping{margin-top:105px;width:220px;line-height:11px;margin-left:-205px;}

17 Apr 2013, 7:50 PM
#13
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

The stock code for that mod actually did something similar to just that.

As the code sits right now:
if a review exists it shows the stars otherwise it doesn't

Do you want a write a review or read reviews next to it no matter what or if review exist a read reviews link and if no reviews exist a write a review link?

Do you want the Average Rating to appear as it should?

Do you want the # of reviews to appear as it should?

17 Apr 2013, 8:01 PM
#14
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

Yes to all your questions, that would be excellent and you are correct, now it only shows the stars if a review exists.

thank you,

rbarbour:

The stock code for that mod actually did something similar to just that.

As the code sits right now:
if a review exists it shows the stars otherwise it doesn't

Do you want a write a review or read reviews next to it no matter what or if review exist a read reviews link and if no reviews exist a write a review link?

Do you want the Average Rating to appear as it should?

Do you want the # of reviews to appear as it should?

17 Apr 2013, 8:33 PM
#15
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

The code below is from my altered version, try it out!

replace this code

if ($reviews->fields['count'] > 0 ) {
    //$lc_text .= TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />';
    $stars_image_suffix = str_replace('.', '_',  zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) /  2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc.
    $average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
    $lc_text .= '<div class="stars-rating">' .  zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $stars_image_suffix .  '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating)) .  '</div>';
 
         }

with:

if ($reviews->fields['count'] > 1 ) {
    $reviews_count_suffix = TEXT_REVIEWS;
  } else {
    $reviews_count_suffix = TEXT_REVIEW;
}
          $lc_text .= '<div class="stars-rating">';
  if ($reviews->fields['count'] > 0 ) {
$stars_image_suffix = str_replace('.', '_', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2);
    $average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
          $lc_text .= '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $listing->fields['products_id']) . '">' . TEXT_REVIEW_FRONT . $reviews->fields['count'] . TEXT_REVIEW_TEXT . $reviews_count_suffix . '</a>' . '<br />' . TEXT_CURRENT_REVIEWS_RATING . TEXT_STRONG_FRONT . $average_rating . TEXT_STRONG_END . '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . TEXT_STARS . $stars_image_suffix . TEXT_IMAGE_FILE, sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating));
  } else {
          $lc_text .= TEXT_REVIEW_FRONT . $reviews->fields['count'] . TEXT_REVIEWS_TEXT . '<br />' . '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $listing->fields['products_id']) . '">' . TEXT_RATING_FIRST . '</a>' . '<br /><br />';
}
          $lc_text .= '</div>';

Then create a file called index_extras.php and place it in:
/includes/languages/english/extra_definitions/YOUR_TEMPLATE_NAME

<?php
/**
 *
 * @copyright Copyright 2013 rbarbour - ZCadditions
 * @license http://www.gnu.org/licenses/ GNU Public License V3.0
 * /includes/languages/english/extra_definitions/YOUR_TEMPLATE_NAME/product_info_extras.php
 */

define('TEXT_CURRENT_REVIEWS', 'Current Reviews:');
define('TEXT_CURRENT_REVIEWS_RATING', 'Average Rating:'); // 2P added - Average Product Rating
define('TEXT_REVIEWS', 's )');
define('TEXT_REVIEW', ' )');
define('TEXT_REVIEW_FRONT', '( ');
define('TEXT_REVIEW_TEXT', ' Review');
define('TEXT_STRONG_FRONT', ' <strong>');
define('TEXT_STRONG_END', '</strong>');
define('TEXT_STARS', 'stars_');
define('TEXT_IMAGE_FILE', '.gif');
define('TEXT_REVIEWS_TEXT', ' Reviews )');
define('TEXT_RATING_FIRST', 'Be the first, write a review!');

?>
17 Apr 2013, 8:39 PM
#16
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

I am modifying this file correct? /includes/modules/YOUR_TEMPLATE_NAME/product_listing.php with the code you provided?

Is there any code in the index_extras.php file?

sorry

rbarbour:

The code below is from my altered version, try it out!

replace this code

if ($reviews->fields['count'] > 0 ) {
//$lc_text .= TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />';
$stars_image_suffix = str_replace('.', '', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc.
$average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
$lc_text .= '<div class="stars-rating">' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars
' . $stars_image_suffix . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating)) . '</div>';

     }
> 
> with:
> ```php
if ($reviews->fields['count'] > 1 ) {
    $reviews_count_suffix = TEXT_REVIEWS;
  } else {
    $reviews_count_suffix = TEXT_REVIEW;
}
          $lc_text .= '<div class="stars-rating">';
  if ($reviews->fields['count'] > 0 ) {
$stars_image_suffix = str_replace('.', '_', zen_round($reviews_average_rating->fields['average_rating'] * 2, 0) / 2);
    $average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
          $lc_text .= '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $listing->fields['products_id']) . '">' . TEXT_REVIEW_FRONT . $reviews->fields['count'] . TEXT_REVIEW_TEXT . $reviews_count_suffix . '</a>' . '<br />' . TEXT_CURRENT_REVIEWS_RATING . TEXT_STRONG_FRONT . $average_rating . TEXT_STRONG_END . '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . TEXT_STARS . $stars_image_suffix . TEXT_IMAGE_FILE, sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating));
  } else {
          $lc_text .= TEXT_REVIEW_FRONT . $reviews->fields['count'] . TEXT_REVIEWS_TEXT . '<br />' . '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $listing->fields['products_id']) . '">' . TEXT_RATING_FIRST . '</a>' . '<br /><br />';
}
          $lc_text .= '</div>';

Then create a file called index_extras.php and place it in:
/includes/languages/english/extra_definitions/YOUR_TEMPLATE_NAME

<?php /** * * @copyright Copyright 2013 rbarbour - ZCadditions * @license http://www.gnu.org/licenses/ GNU Public License V3.0 * /includes/languages/english/extra_definitions/YOUR_TEMPLATE_NAME/product_info_extras.php */ define('TEXT_CURRENT_REVIEWS', 'Current Reviews:'); define('TEXT_CURRENT_REVIEWS_RATING', 'Average Rating:'); // 2P added - Average Product Rating define('TEXT_REVIEWS', 's )'); define('TEXT_REVIEW', ' )'); define('TEXT_REVIEW_FRONT', '( '); define('TEXT_REVIEW_TEXT', ' Review'); define('TEXT_STRONG_FRONT', ' <strong>'); define('TEXT_STRONG_END', '</strong>'); define('TEXT_STARS', 'stars_'); define('TEXT_IMAGE_FILE', '.gif'); define('TEXT_REVIEWS_TEXT', ' Reviews )'); define('TEXT_RATING_FIRST', 'Be the first, write a review!'); ?>
17 Apr 2013, 8:43 PM
#17
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

Coins2012:

I am modifying this file correct? /includes/modules/YOUR_TEMPLATE_NAME/product_listing.php with the code you provided?

correct

Coins2012:

Is there any code in the index_extras.php file?

sorry

yes, I updated post. Forgot it :blush:

17 Apr 2013, 11:27 PM
#18
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Adding Date Available with a message to items that will be sold...

worked fine, is there a way to add some blank line, everything looks cramped up http://www.aydincoins.com/buy-silver/silver-rounds.

Also, after we did this change, the product detail page shows 'Average Rating:', can we remove this wording, just have the stars and the link shown, http://www.aydincoins.com/buy-silver/silver-rounds/1-coin-lot-1-ounce-silver-buffalo-round-coin-999-fine-silver

thank you

rbarbour:

correct

yes, I updated post. Forgot it :blush:

17 Apr 2013, 11:40 PM
#19
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

in your stylesheet.css

find:
#productListing .stars-rating{margin-top:25px;}

change to:
#productListing .stars-rating{position:relative;bottom:-20px;}

I am not sure why that part of the code was left in the product_info page if all your website designer wanted to do was show the stars if a review existed but make the appropriate changes to /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_product_info_display.php

find:

$average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
           echo TEXT_CURRENT_REVIEWS_RATING . '' .  zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $stars_image_suffix .  '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating));

change to:

$average_rating = zen_round($reviews_average_rating->fields['average_rating'], 2);
           echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $stars_image_suffix .  '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $average_rating));
17 Apr 2013, 11:44 PM
#20
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Adding Date Available with a message to items that will be sold...

Do to the layout style of your product listing page, the reviews would look better under the product image, this would fill up some of the "white space".