S
S
strify_252016-10-04 16:06:28
Smarty
strify_25, 2016-10-04 16:06:28

How to get product url by id in old version of webasyst?

The site uses an old version of webasyst (I can't say which one exactly). The new forum could not help with this problem, and the old one does not work. What is the question: Similar products are displayed on the product cards using an sql query (as 3 following the current one). However, their address is displayed as /?productID=123 , and upon transition, a redirect to the CNC page occurs. Here is the template code

<table style="width: 100%; padding: 0px;">

<tr>

<td id="prddeatailed_container">

<div class="products-img">{cpt_product_images}</div>

<div class="products-info-block">{cpt_product_name overridestyle='1:dtxmdm'}{cpt_product_params_selectable overridestyle=''}{cpt_product_params_fixed overridestyle=''}{cpt_product_rate_form overridestyle=''}{cpt_product_price overridestyle=''}{cpt_product_add2cart_button request_product_count='request_product_count' overridestyle=':iuxflk'}{cpt_product_description overridestyle=''}

<!-- cpt_container_end -->

</div>

</td>

</tr>

<tr>

<td>

<!-- cpt_container_start -->{cpt_product_discuss_link overridestyle=''}{cpt_product_related_products overridestyle=''}{cpt_product_details_request overridestyle=''}<!-- cpt_container_end -->

</td>

</tr>

</table>

<div class="sim-block">

<h2><span>Похожие товары</span></h2>

<table width="100%;">

<tr>

{php}

$id = (int)$_GET['productID'];

$countSQL = "SELECT p.productID, p.name_ru FROM SC_products p LEFT JOIN SC_category_product cp ON (p.categoryID = cp.categoryID)WHERE p.productID > ".$id." AND p.categoryID = (SELECT p.categoryID FROM SC_products p WHERE p.productID = ".$id.") ORDER BY productID ASC LIMIT 3";

$queryCount = mysql_query($countSQL);

$count =  mysql_num_rows($queryCount);

if($count==0){

$s = "p.productID < ".$id."";

}

else{

$s = "p.productID > ".$id."";

}

$sql = "SELECT p.productID, p.name_ru FROM SC_products p LEFT JOIN SC_category_product cp ON (p.categoryID = cp.categoryID)WHERE ".$s." AND p.categoryID = (SELECT p.categoryID FROM SC_products p WHERE p.productID = ".$id.") ORDER BY productID ASC LIMIT 3";

$query = mysql_query($sql);

$images = array();

while($results = mysql_fetch_assoc($query)){

$sql_img = "SELECT filename,productID FROM SC_product_pictures WHERE productID=".$results['productID']." ORDER BY productID ASC LIMIT 1";

$query_sql_img = mysql_query($sql_img);

while($img = mysql_fetch_assoc($query_sql_img)){

$images[$img['productID']] = $img['filename'];

}

{/php}

<td style="text-align: center;">

<a href="?productID={php}echo $results['productID']{/php}">

<img src="/published/publicdata/MODERN791/attachments/SC/products_pictures/{php} echo $images[$results['productID']]; {/php}" style=" width: 150px;  height: 150px; padding: 5px;" />

</a>

<br/>

<a href="?productID={php}echo $results['productID']{/php}">{php}echo $results['name_ru'];{/php}</a>

</td>

{php}

}

{/php}

</tr>

</table>

</div>

Please help me get the nc url of the product by its id

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question