X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   MAP Pricing Mod (https://forum.x-cart.com/showthread.php?t=8079)

chilll33 01-08-2005 08:25 AM

Quote:

Originally Posted by ETInteractive.com
your not using products.tpl

if you have multiple rows of products (you have 3 per row)

you need to customize "products_t.tpl"

the code would be basically the same at product.tpl to display the MAP.


Thanks, I am using the following code to call the extra field in product.tpl:

{if $extra_field[1].field_value ne "Y"}


I have not found a way to call this from the products_t.tpl.
any tips help.

Thanks.

chilll33 01-08-2005 08:43 PM

Well took me a while but I finally got my MAP Price mod working in 4.0.9

DogByteMan 01-09-2005 04:35 AM

Want to post and share the final code changes here?

chilll33 01-15-2005 08:45 AM

This is what I have so far:

First apply

Save as modules/Extra_Fields/extra_fields_array.php
Code:

<?php

if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }

$provider_condition = ($single_mode?"":" AND $sql_tbl[extra_fields].provider='$extra_fields_provider' ");
if($products) {
foreach($products as $product) {
$productid = $product['productid'];
$extra_fields[$productid] = func_query("SELECT $sql_tbl[extra_fields].*, $sql_tbl[extra_field_values].value as field_value, IF($sql_tbl[extra_field_values].fieldid > 0, 'Y', '') as is_value FROM $sql_tbl[extra_fields] LEFT JOIN $sql_tbl[extra_field_values] ON $sql_tbl[extra_fields].fieldid = $sql_tbl[extra_field_values].fieldid AND $sql_tbl[extra_field_values].productid = '$productid' WHERE 1 $provider_condition ORDER BY $sql_tbl[extra_fields].fieldid");
}
}

$smarty->assign("extra_fields",$extra_fields);
?>


Patch products.php
Quote:
Code:

--- /hsphere/local/home/wwwuser/tch405gold/products.php 2004-09-29 23:23:34.000000000 -0700
+++ products.php 2004-10-20 18:43:11.000000000 -0700
@@ -82,6 +82,13 @@
include $xcart_dir."/modules/Subscriptions/subscription.php";
}

+#RJS:extra_fields start
+if(!empty($active_modules["Extra_Fields"])) {
+ $extra_fields_provider=$product_info["provider"];
+ include $xcart_dir."/modules/Extra_Fields/extra_fields_array.php";
+}
+#RJS:extra_fields end
+
$smarty->assign("products",$products);
$smarty->assign("navigation_script","home.php?cat=$cat&sort=$sort&sort_direction=$sort_direction");
?>


as in http://forum.x-cart.com/viewtopic.php?t=13217&postdays=0&postorder=asc&hig hlight=map%20price&start=15

then
in customer/main/
product.tpl

Code:

{if $active_modules.Subscriptions ne "" and $subscription}
{include file="modules/Subscriptions/subscription_info.tpl"}
{else}
{if $extra_fields[4].field_value ne "Y"}
<TR><TD class="ProductPriceConverting" valign="top">{$lng.lbl_list_price}:</TD>
<TD valign="top">
{else}
<TR><TD class="ProductPriceConverting" valign="top">{$lng.lbl_map}:<a onclick="newwindow=window.open('http://www.wiredparadise.com/mapprice.htm','Foretrex101','width=320,height=230')" href="#">
<font color="#0000FF" size="1">What is this?</font></a></TD>
<TD valign="top">
{include file="currency.tpl" value=$product.list_price}</TD>
</TR>
{/if}
<TR><TD class="ProductPriceConverting" valign="top">{$lng.lbl_price}:</TD>
<TD valign="top">
{if $extra_fields[4].field_value ne "Y"}
<FONT class="ProductDetailsTitle"><SPAN id="product_price">{include file="currency.tpl" value=$product.taxed_price}</SPAN></FONT><FONT class="MarketPrice"> <SPAN id="product_alt_price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.taxed_price}</SPAN></FONT>
{if $product.taxes}
{include file="customer/main/taxed_price.tpl" taxes=$product.taxes}{/if}
{else}
<font color="#FF0000">{$lng.lbl_map_price}</font>
{/if}
</TD>
</TR>
{/if}
</TABLE>


and products_t.tpl

Code:

{$lng.lbl_see_details}


{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{assign var="pid" value=$products[product].productid}
{if $products[product].taxed_price ne 0}
{if $products[product].list_price gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%d" assign=discount}
{if $discount gt 0}
{if $extra_fields[$pid][4].field_value ne "Y"}
<FONT class="MarketPrice">{$lng.lbl_market_price}: <S>
{include file="currency.tpl" value=$products[product].list_price}</S>
{else}
<FONT class="MarketPrice">{$lng.lbl_map}:
{include file="currency.tpl" value=$products[product].list_price}
</FONT>

{/if}
{/if}
{/if}
{if $extra_fields[$pid][4].field_value ne "Y"}
<FONT class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</FONT>
<FONT class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</FONT>{if $discount gt 0}, save {$discount}%{/if}
{if $products[product].taxes}
{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{else}
<FONT class="ProductPrice">{$lng.lbl_our_price}:
<font color="#FF0000">{$lng.lbl_map_price}</font>
{/if}
{/if}
{/if}
{if $active_modules.Feature_Comparison ne '' && $products[product].fclassid > 0}


{include file="modules/Feature_Comparison/compare_checkbox.tpl" id=$products[product].productid}
{/if}
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{/if}
</TD>



preview http://wiredparadise.com/shop/home.php?cat=719

only problem I cannot figure out yet is why this is not working in featured products in the home page, or the search box.

If any one has a solution please let me know.

nfc5382 01-02-2007 08:00 PM

Re: MAP Pricing Mod
 
you have another link for an example? one you posted is a gone


All times are GMT -8. The time now is 09:10 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.