Error_occured when opening admin panel After upgrade to CSC-P 3.0.2

Please run the following query:

CREATE TABLE `cscart_category_vendor_product_count` (
  `company_id` int(11) unsigned NOT NULL DEFAULT '0',
  `category_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `product_count` mediumint(8) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`company_id`,`category_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Added left join in products table, but getting error "Service Enable" and check the logs missing half table name but, output correctly displayed in phpmyadmin. I don't know "How making a mistake and fix it".

Query:

 $join .= db_quote("SELECT * FROM ?:offline_sale LEFT JOIN ?:products ON ?:offline_sale.product_id = ?:products.product_id WHERE offline_type ='D'");

Error:-

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM cscart_offline_sale LEFT JOIN cscart_products ON cscart_offline_sa' at line 1 (1064)
Query: SELECT SQL_CALC_FOUND_ROWS products.product_id, descr1.product as product, companies.company as company_name, cscart_supplier_links.supplier_id FROM cscart_products as products LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = 'en' LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id AND prices.lower_limit = 1 LEFT JOIN cscart_companies AS companies ON companies.company_id = products.company_id INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id AND (cscart_categories.usergroup_ids = '' OR FIND_IN_SET(0, cscart_categories.usergroup_ids) OR FIND_IN_SET(1, cscart_categories.usergroup_ids)) AND cscart_categories.status IN ('A', 'H') LEFT JOIN cscart_supplier_links ON cscart_supplier_links.object_id = products.product_id AND cscart_supplier_links.object_type = 'P' SELECT * FROM cscart_offline_sale LEFT JOIN cscart_products ON cscart_offline_sale.product_id = cscart_products.product_id WHERE offline_type = D WHERE 1 AND cscart_categories.category_id IN (2095, 176, 175, 185, 186, 202, 187, 188, 189, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 285, 286, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 404, 405, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 1670, 1671, 1672, 1673, 1674, 1675, 2360, 2361) AND companies.status = 'A' AND (products.usergroup_ids = '' OR FIND_IN_SET(0, products.usergroup_ids) OR FIND_IN_SET(1, products.usergroup_ids)) AND products.status IN ('A') AND prices.usergroup_id IN (0, 0, 1) GROUP BY products.product_id ORDER BY products_categories.position asc, product_id ASC LIMIT 0, 20

Your query is not correct, you did not add join, but added separate request. As a result, final query is not correct. Please check how to use $join parameter in standard functions

after install the addon admin panel login is not working(Its redirects to same page) but addon functionality correctly working.How to fix this issue?

Regards,

naga mahesh

after install the addon admin panel login is not working(Its redirects to same page) but addon functionality correctly working.How to fix this issue?

What addon do you mean?

I have developed own mobule in addons(addon name: offline sale) and adding commission block in product view page using hooks.

front end hook files:

main_info_title.post.tpl

data_block.pre.tpl

quick_view_title.post.tpl

view_main_info.post.tpl

backend files:

products.post.php

What addon do you mean?

I have developed own mobule in addons(addon name: offline sale) and adding commission block in product view page using hooks. Its related to discussion addon(display rating).please help me.

front end hook files:

main_info_title.post.tpl

data_block.pre.tpl

quick_view_title.post.tpl

view_main_info.post.tpl

backend files:

products.post.php

It is hard to answer on your question without code examination. PM me temporary FTP access and we will check the issue with the admin panel

It is hard to answer on your question without code examination. PM me temporary FTP access and we will check the issue with the admin panel

I am working in localhost. please check the following code:

design/templates/addons/offline_sale/hooks/products/main_info_title.post.tpl

{assign var="commission" value=fn_get_offline_sale()}

            

            

             

app/addons/offline_sale/controllers/frontend/products.post.php

use Tygh\Registry;

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

if ($mode == ‘view’ || $mode == ‘quick_view’) {

$product = Tygh::$app['view']->getTemplateVars('product');
$product['offline_sale'] = fn_get_offline_sale($product['product_id'], "P", true, $_REQUEST);
Tygh::$app['view']->assign('product', $product);

}

app/addons/offline_sale/func.php

function fn_get_offline_sale($object_id, $object_type, $get_posts = false, $params = array())
{
$comm = Registry::get(‘addons.offline_sale’);

// As per setting commission value of offline sale

$product_price = db_get_field("SELECT price FROM ?:product_prices WHERE product_id = '$_REQUEST[product_id]'");

$commission = ($product_price/100) * $comm[offline_sale_offline_sale] + $product_price;

return $commission;

}

This code is added after that admin login is not working and to remove this code admin login access working correctly.

Try to add

use Tygh\Registry;

to the func.php file

Try to add

use Tygh\Registry;

to the func.php file

yah. I have already added this link. Please show added links that file.

use Tygh\Enum\ProductTracking;

use Tygh\Registry;

use Tygh\Session;

use Tygh\Mailer;

yah. I have already added this link. Please show added links that file.

use Tygh\Enum\ProductTracking;

use Tygh\Registry;

use Tygh\Session;

use Tygh\Mailer;

/***************************************************************************

  • Author: Mohan, Satya *

  • Company: Dealmaar Technologies Pvt. Ltd


  • PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *

  • “copyright.txt” FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *

****************************************************************************/

use Tygh\Registry;

use Tygh\Session;

use Tygh\Mailer;

// adding offline option in product page.

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

function fn_offline_sale_update_product_post(&$product_data){

$comm = Registry::get('addons.offline_sale');

$date = date("Y-m-d H:i:s");

$db_sel = db_get_field("SELECT product_id FROM ?:offline_sale WHERE product_id = '$_REQUEST[product_id]'");

$product_id = $_REQUEST[product_id];

if(empty($product_id))
{
  $prd_id = db_get_field("SELECT product_id From ?:products ORDER BY product_id DESC LIMIT 1");
  $prod_id = $prd_id+1;
  
} else
{
   $prod_id = $_REQUEST[product_id];
}

$offline = $product_data['offline'];

 if(empty($db_sel))
 {
    $db_insert = db_query("INSERT ?:offline_sale (product_id,commission, product_update_date, offline_type) VALUES('$prod_id',' $comm[offline_sale_offline_sale]' , '$date', '$offline')");
 }
 else
 {
   $db_update = db_query("UPDATE ?:offline_sale SET product_update_date = '$date',commission='$comm[offline_sale_offline_sale]', offline_type = '$offline' WHERE product_id = '$db_sel'"); 
 }

}

function fn_get_offline_data($p_id)
{

$pro_sel = db_get_field(“SELECT offline_type FROM ?:offline_sale WHERE product_id = ‘$p_id’”);

return $pro_sel;

}

function fn_offline_sale_get_products(&$params, &$fields, &$sortings, &$condition, &$join, &$sorting, &$group_by, &$lang_code, &$having,$p_id)
{

$join .= db_quote(“LEFT JOIN ?:offline_sale as offline ON offline.product_id = products.product_id”);

$condition .= " AND offline.offline_type IN (‘D’,‘DA’)";

return true;
}

function fn_offline_sale_get_orders(&$params, &$fields, &$sortings, &$condition, &$join)
{

$join .= " LEFT JOIN ?:order_details ON ?:order_details.order_id = ?:orders.order_id LEFT JOIN ?:offline_sale ON ?:offline_sale.product_id =?:order_details.product_id";

$condition .= " AND ?:offline_sale.offline_type IN (‘D’,‘DA’)";

return true;

}

function fn_get_offline_sale($offline_sale,$object_id, $object_type, $get_posts = false, $params = array())
{
$comm = Registry::get(‘addons.offline_sale’);

// As per setting commission value of offline sale

$product_price = db_get_field("SELECT price FROM ?:product_prices WHERE product_id = '$_REQUEST[product_id]'");

$commission = ($product_price/100) * $comm[offline_sale_offline_sale] + $product_price;

return $commission;

}

?>

same problem

/***************************************************************************

  • Author: Mohan, Satya *

  • Company: Dealmaar Technologies Pvt. Ltd


  • PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *

  • “copyright.txt” FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *

****************************************************************************/

use Tygh\Registry;

use Tygh\Session;

use Tygh\Mailer;

// adding offline option in product page.

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

function fn_offline_sale_update_product_post(&$product_data){

$comm = Registry::get('addons.offline_sale');

$date = date("Y-m-d H:i:s");

$db_sel = db_get_field("SELECT product_id FROM ?:offline_sale WHERE product_id = '$_REQUEST[product_id]'");

$product_id = $_REQUEST[product_id];

if(empty($product_id))
{
  $prd_id = db_get_field("SELECT product_id From ?:products ORDER BY product_id DESC LIMIT 1");
  $prod_id = $prd_id+1;
  
} else
{
   $prod_id = $_REQUEST[product_id];
}

$offline = $product_data['offline'];

 if(empty($db_sel))
 {
    $db_insert = db_query("INSERT ?:offline_sale (product_id,commission, product_update_date, offline_type) VALUES('$prod_id',' $comm[offline_sale_offline_sale]' , '$date', '$offline')");
 }
 else
 {
   $db_update = db_query("UPDATE ?:offline_sale SET product_update_date = '$date',commission='$comm[offline_sale_offline_sale]', offline_type = '$offline' WHERE product_id = '$db_sel'"); 
 }

}

function fn_get_offline_data($p_id)
{

$pro_sel = db_get_field(“SELECT offline_type FROM ?:offline_sale WHERE product_id = ‘$p_id’”);

return $pro_sel;

}

function fn_offline_sale_get_products(&$params, &$fields, &$sortings, &$condition, &$join, &$sorting, &$group_by, &$lang_code, &$having,$p_id)
{

$join .= db_quote(“LEFT JOIN ?:offline_sale as offline ON offline.product_id = products.product_id”);

$condition .= " AND offline.offline_type IN (‘D’,‘DA’)";

return true;
}

function fn_offline_sale_get_orders(&$params, &$fields, &$sortings, &$condition, &$join)
{

$join .= " LEFT JOIN ?:order_details ON ?:order_details.order_id = ?:orders.order_id LEFT JOIN ?:offline_sale ON ?:offline_sale.product_id =?:order_details.product_id";

$condition .= " AND ?:offline_sale.offline_type IN (‘D’,‘DA’)";

return true;

}

function fn_get_offline_sale($offline_sale,$object_id, $object_type, $get_posts = false, $params = array())
{
$comm = Registry::get(‘addons.offline_sale’);

// As per setting commission value of offline sale

$product_price = db_get_field("SELECT price FROM ?:product_prices WHERE product_id = '$_REQUEST[product_id]'");

$commission = ($product_price/100) * $comm[offline_sale_offline_sale] + $product_price;

return $commission;

}

?>

same problem

I should debug the code to find the reason

I should debug the code to find the reason

ok

Are you using php hooks? If so, you need a init.php file naming the hooks you're hooking into.

Are you using php hooks? If so, you need a init.php file naming the hooks you're hooking into.

yes, I am using php hooks.its rights to mention file naming init.php but i wrote the function (fn_get_offline_sale) is another method.The method is using fn_set_hook().

function fn_get_offline_sale($object_id, $object_type, $get_posts = false, $params = array())
{	
	$comm = Registry::get('addons.offline_sale');
// As per setting commission value of offline sale

$product_price = db_get_field("SELECT price FROM ?:product_prices WHERE product_id = '$_REQUEST[product_id]'");

$commission = ($product_price/100) * $comm[offline_sale_offline_sale] + $product_price;

fn_set_hook('get_offline_sale', $object_id, $object_type, $commission);

    return commission;

}

I added fn_set_hook method but same problem if any correction following code please help us.

Hi,

I downloaded the website v4.3.9 . I placed the files in localhost and modified config.local.php and .htaccess files and connected database also setting correctly. After that running in localhost, BUT the front end is not displayed and the backend (adminpanel) doesn't open.The message shows "service unavailable".

Then I opened the source code of the error page (Ctrl + U) and check the error message

Tygh\Exceptions\AException

Message

Unknown column ‘cscart_status_descriptions.status_id’ in ‘on clause’ (1054)
SELECT cscart_statuses., cscart_status_descriptions. FROM cscart_statuses LEFT JOIN cscart_status_descriptions ON cscart_status_descriptions.status_id = cscart_statuses.status_id AND cscart_status_descriptions.lang_code = ‘ru’ WHERE 1 AND cscart_statuses.type = ‘O’

Error at

H:\OSPanel\domains\cscartv439.ross\app\Tygh\Database\Connection.php, line: 863
Backtrace

File: H:\OSPanel\domains\cscartv439.ross\app\Tygh\Database\Connection.php
Line: 458
Function: error
File: H:\OSPanel\domains\cscartv439.ross\app\Tygh\Database\Connection.php
Line: 262
Function: query
File: H:\OSPanel\domains\cscartv439.ross\app\functions\fn.database.php
Line: 41
Function: getHash
File: H:\OSPanel\domains\cscartv439.ross\app\functions\fn.common.php
Line: 3659
Function: db_get_hash_array
File: H:\OSPanel\domains\cscartv439.ross\var\cache\templates\backend\c258cb7f61ffdf17ba6f188f2f36fa2ce1f5c905.tygh.styles.tpl.php
Line: 30
Function: fn_get_statuses
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php
Line: 188
Function: content_5a034712a74bf1_13374851
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php
Line: 304
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\var\cache\templates\backend\6b2addbd8386bf3e753c9ac8ddcf3cce82914e7f.tygh.styles.tpl.php
Line: 42
Function: getSubTemplate
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php
Line: 188
Function: content_5a0347120c7e98_84050224
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php
Line: 304
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\var\cache\templates\backend\7d05a84c036846308eb42aa1e01f405ed1800c7b.tygh.index.tpl.php
Line: 57
Function: getSubTemplate
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php
Line: 188
Function: content_5a03471193f2a4_08910341
File: H:\OSPanel\domains\cscartv439.ross\app\Tygh\SmartyEngine\Core.php
Line: 73
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\app\functions\fn.control.php
Line: 615
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\admin.php
Line: 27
Function: fn_dispatch

This error means that the status_id field is missed in the cscart_status_descriptions table in my database for some reason (Thanks CS-Cart team)

Run the following SQL query in my phpMyAdmin tool on my server:

ALTER TABLE `cscart_status_descriptions` ADD `status_id` MEDIUMINT(8) NOT NULL;

Same problem is faced after running this Query.

Tygh\Exceptions\AException

Message

Unknown column ‘status_id’ in ‘field list’ (1054)
SELECT status_id, param, value FROM cscart_status_data WHERE status_id IN (1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20)

Error at

H:\OSPanel\domains\cscartv439.ross\app\Tygh\Database\Connection.php, line: 863
Backtrace

File: H:\OSPanel\domains\cscartv439.ross\app\Tygh\Database\Connection.php
Line: 458
Function: error
File: H:\OSPanel\domains\cscartv439.ross\app\Tygh\Database\Connection.php
Line: 353
Function: query
File: H:\OSPanel\domains\cscartv439.ross\app\functions\fn.database.php
Line: 90
Function: getMultiHash
File: H:\OSPanel\domains\cscartv439.ross\app\functions\fn.common.php
Line: 3667
Function: db_get_hash_multi_array
File: H:\OSPanel\domains\cscartv439.ross\var\cache\templates\backend\c258cb7f61ffdf17ba6f188f2f36fa2ce1f5c905.tygh.styles.tpl.php
Line: 30
Function: fn_get_statuses
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php
Line: 188
Function: content_5a034712a74bf1_13374851
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php
Line: 304
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\var\cache\templates\backend\6b2addbd8386bf3e753c9ac8ddcf3cce82914e7f.tygh.styles.tpl.php
Line: 42
Function: getSubTemplate
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php
Line: 188
Function: content_5a0347120c7e98_84050224
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php
Line: 304
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\var\cache\templates\backend\7d05a84c036846308eb42aa1e01f405ed1800c7b.tygh.index.tpl.php
Line: 57
Function: getSubTemplate
File: H:\OSPanel\domains\cscartv439.ross\app\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php
Line: 188
Function: content_5a03471193f2a4_08910341
File: H:\OSPanel\domains\cscartv439.ross\app\Tygh\SmartyEngine\Core.php
Line: 73
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\app\functions\fn.control.php
Line: 615
Function: fetch
File: H:\OSPanel\domains\cscartv439.ross\admin.php
Line: 27
Function: fn_dispatch

The same field is missed in the cscart_status_data table in database (Thanks CS-Cart team)

Run the following SQL query to fix the issue:

ALTER TABLE `cscart_status_data` ADD `status_id` MEDIUMINT(8) NOT NULL;

Some problem occurs after perform this query

Tygh\Exceptions\AException

Message

Unknown column ‘status_id’ in ‘field list’ (1054)
SELECT status_id, email_subj, email_header FROM cscart_ult_status_descriptions WHERE status_id IN (‘’) AND company_id = 1 AND lang_code = ‘ru’

Error at

H:\OSPanel\domains\cscartv439.ross\app\Tygh\Database\Connection.php, line: 863

​​

How to resolve these issues? Please help^^.

Regards,

How to resolve these issues? Please help^^.

Run

ALTER TABLE `cscart_ult_status_descriptions` ADD `status_id` MEDIUMINT(8) NOT NULL;

Run

ALTER TABLE `cscart_ult_status_descriptions` ADD `status_id` MEDIUMINT(8) NOT NULL;

Some problem occurs after perform this query

Tygh\Exceptions\AException
Message
Unknown column 'cscart_categories.is_trash' in 'order clause' (1054)

In my case I should add a new field "is_trash" and it will be:

ALTER TABLE cscart_categories ADD `is_trash` char(1) NOT NULL DEFAULT 'N';

After this command, the site and the admin panel started working correctly

Special Thank's to team eComLabs

Site and the admin panel working, but unfortunately, again the error occurred

This message is seen in the admin panel​:

PHP Warning
Message
substr_compare(): The start position cannot exceed initial string length
Error at
H:\OSPanel\domains\cscartv439.ross\app\Tygh\Less.php, line: 317