Mass action stopped working

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #237592

Hi,

I have mass action where products are removed after 1 week. For some reason products are not removed even I process it manually.

Here is the screenshot of my settings.
Not sure if it is related but I tried to increase value to 5000 and received error:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1134,1136,1139,1141,1145,1150,865,863,854,856,858,861,913,911,908,906,903,852,84' at line 1 SQL=DELETE FROM #__hikashop_product_category WHERE category_id IN(164) AND product_id IN(2567,779,765,767,769,762,763,758,760,1434,1251,1249,1247,1243,1245,1241,1438,2552,1429,1239,1201,1203,1205,1207,1209,1211,1212,1213,1215,1217,1219,1221,1223,1225,1227,1229,1231,1233,1235,1237,1065,1066,1067,1068,2553,1424,1420,1199,1197,1195,1182,1183,1184,1185,1187,1189,1191,1193,1180, and SO ON......

Any help would be appreciated.

Thanks

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 67676
  • Thank you received: 10046
  • MODERATOR
3 years 7 months ago #237597

Hi,

Could you provide the full MySQL query ?

Please Log in or Create an account to join the conversation.

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #237667

I am sorry but i am not sure what you asking for so if you could tell me what to do i would give you that information. As i am not familiar with mysql.

Thanks

Last edit: 3 years 7 months ago by kyratn.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2319
  • MODERATOR
3 years 7 months ago #237674

Hi,

Instead of the ", and SO ON...." give all the request, so all the other ids until the end of the request.
There is certainly a parameter near the end which is causing this issue.

Please Log in or Create an account to join the conversation.

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #237753

Ahh I see, here is full error:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1134,1136,1139,1141,1145,1150,865,863,854,856,858,861,913,911,908,906,903,852,84' at line 1 SQL=DELETE FROM #__hikashop_product_category WHERE category_id IN(164) AND product_id IN(2567,779,765,767,769,762,763,758,760,1434,1251,1249,1247,1243,1245,1241,1438,2552,1429,1239,1201,1203,1205,1207,1209,1211,1212,1213,1215,1217,1219,1221,1223,1225,1227,1229,1231,1233,1235,1237,1065,1066,1067,1068,2553,1424,1420,1199,1197,1195,1182,1183,1184,1185,1187,1189,1191,1193,1180,1442,1179,1172,1177,1176,1174,1171,1169,1168,1167,1165,1163,1161,1159,1158,1157,1155,1153,1152,1151,1149,1148,1147,1146,1144,1143,1072,1073,1074,1076,1077,1078,1079,1080,1081,1083,1084,2560,2558,1089,1090,1092,1093,1095,1096,1097,1098,2559,1102,2554,1109,1111,1113,1114,1115,1116,1117,1118,1135,1137,1138,1140,1142,1071,1412,1414,2571,2570,2569,2568,1418,757,2566,2565,2564,1441,1440,1439,1437,1436,1433,1435,1062,2544,943,2548,2547,2546,2545,1133,1054,1053,1052,2561,1050,1049,1048,2562,1041,1042,1043,1044,1046,1047,2563,1036,1035,1033,1032,1029,1031,1028,1026,1027,1025,1024,1022,1021,1020,1019,1017,1016,1015,1002,1003,1005,1006,1014,989,991,992,996,997,999,1000,988,986,985,983,982,980,979,974,973,971,970,1416,1432,1431,1430,1428,1427,2572,1426,1425,967,968,965,963,961,959,957,955,954,952,951,949,947,946,944,1410,1408,1406,1404,1355,1357,1359,1361,1363,1365,1369,1372,1373,1374,1375,1376,1377,1378,1379,1380,1382,1384,1386,1388,1390,1392,1394,1396,1398,1400,1402,1342,1344,1423,1421,1422,1419,1417,1415,1413,1411,1407,1409,1405,1349,1353,941,934,937,939,931,2550,2551,759,761,889,891,892,894,895,897,900,902,905,907,909,910,912,914,916,918,920,922,924,926,928,764,766,768,770,1340,1338,1333,1336,1401,1403,1397,1399,1391,1393,1395,1387,1389,1385,1345,1346,1347,1348,1350,1351,1352,1354,1356,1358,1360,1362,1364,1366,1367,1368,1370,1371,1381,1383,771,773,775,777,1327,1330,1324,1321,1258,1261,1264,1267,1269,1271,1273,1275,1277,1279,1282,1286,1289,1292,1297,1299,1301,1303,1305,1307,1309,1311,1313,1315,1317,1319,1256,1220,1222,1224,1226,1228,1230,1232,1234,1236,1238,1240,1242,1244,1246,1248,1250,1252,1254,1196,1198,1200,1202,1204,1206,1208,1210,1214,1216,1218,1194,1190,1192,1188,1178,1181,1186,1160,1162,1164,1166,1170,1173,1175,883,887,880,882,879,873,875,877,867,869,871,1156,915,917,919,921,923,925,927,929,932,935,938,940,942,945,948,950,953,956,958,960,962,964,966,969,972,978,981,984,987,990,993,998,1001,1004,1013,1018,1023,1030,1034,1040,1045,1051,1055,1061,1064,1069,1075,1082,1085,1091,1094,1099,1106,1112,1119,1120,1121,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132)1134,1136,1139,1141,1145,1150,865,863,854,856,858,861,913,911,908,906,903,852,848,850,846,901,1343,1341,1339,834,836,838,840,842,844,827,828,830,832,823,824,825,818,819,820,822,864,866,868,870,872,874,876,878,881,884,888,890,893,896,899,845,862,860,857,855,853,851,847,849,843,841,1337,1335,1332,1331,817,839,837,835,815,814,813,812,810,809,798,800,801,802,804,805,806,859,781,783,785,787,789,791,793,795,826,829,831,833,797,816,821,807,808,799,811,1329,1328,1318,1320,1322,1323,1325,803,786,788,790,792,1316,1308,1310,1312,1314,796,2549,1294,1295,1296,1298,1300,1302,1304,1306,1288,1290,1291,1283,1284,1285,1287,1274,1276,1278,1280,1266,1268,1270,1272,1260,1263,1253,1255,1257,794,778,780,784,782,776,774,772,1154,2573,2576,2577,2578,2579,2580,2581,2582,2584,2585,2586,2587,2588,2589,2590,2591,2592,2594,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2610,2611,2612,2613,2614,2615,2616,2617,2618,2619,2621,2622,2623,2624,2625,2626,2633,2634,2635,2636,2631,2632,2637,2638,2639,2640,2641,2642,2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2675,2676,2673,2674,2672,2677,2678,2679,2680,2681,2682,2683,2696,2695,2694,2693,2692,2691,2688,2687,2689,2690,2686,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720,2721,2722,2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751,2752,2753,2754,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,2767,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779,2780,2781,2782,2783,2784,2785,2786,2787,2788,2789,2790,2791,2792,2793,2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,2830,2831,2941,2985,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856,2857,2858,2859,2860,2861,2862,2863,2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2881,2878,2880,2882,2883,2884,2885,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927) 

Its just ID's and nothing more

Also adding products to category "NEW" after product created is working without any problems....

Thanks

Last edit: 3 years 7 months ago by kyratn.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2319
  • MODERATOR
3 years 7 months ago #237776

Hi,

In you mass action settings it is better to limit to 500 products per request. Else it will consume too much resources.
That should solve your issue.

Else you can install the attached plugin containing a fix.

File Attachment:

File Name: plg_hikash...4-22.zip
File Size:16 KB

Attachments:
Last edit: 3 years 7 months ago by Xavier.

Please Log in or Create an account to join the conversation.

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #237836

Hi,

Well, I have installed your plugin but it made no difference. Mass action still doesn't work.
That configuration was set for about 3 months and I had no issues. Only last week I noticed that I have more then half products in category new. Products created more then 1 month ago are still there....
Tried today again to process it manually but still no products removed from that category.
I also have tried to create new mass action and no luck...

What could be the problem and how can I solve this issue?
I use configurations attached in my first post.


Many thanks

Last edit: 3 years 7 months ago by kyratn.

Please Log in or Create an account to join the conversation.

  • Posts: 67676
  • Thank you received: 10046
  • MODERATOR
3 years 7 months ago #237920

Hi,

We've added additional fixes for that.
Download the install package of HikaShop on our website and install it on yours and that will fix the problem.

The following user(s) said Thank You: kyratn

Please Log in or Create an account to join the conversation.

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #237970

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #239291

Hi,

I only now tried to look again into this as i had no time....I have updated hikashop to 2.6.3 and remove products from category still doesnt work for me. I am happy to give login to my test site so you could find problem.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2319
  • MODERATOR
3 years 7 months ago #239315

Hi,

Yes please provide a backend and FTP access via our contact form with a link to this topic in your message.
www.hikashop.com/support/contact-us.html

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2319
  • MODERATOR
3 years 7 months ago #239338

Hi,

I reveived the backend access, but not the FTP one, please send it via our contact form too.

Please Log in or Create an account to join the conversation.

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #239412

Hi,

FTP details have been sent.

Regards

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2319
  • MODERATOR
3 years 7 months ago #239507

Hi,

I just tried and the mass action seems to be working as expected now.
The MySQL query is valid, no errors.

But if you expect it to be automatic based on a period trigger, this will not work as you cron task is not set correctly.
You does not have attached your subscription to this domain.

Please Log in or Create an account to join the conversation.

  • Posts: 1113
  • Thank you received: 112
3 years 7 months ago #239535

Hi,

Thanks for update, it seems it is working now. Should I do something to add to my live site?

Why would you say that my cron task is not set correctly? I have another mass action created to add products to that category and it does work automatically....

And my subscription is attached to this domain, well that's what it shows in hikashop->subscription page.

Thank you

Last edit: 3 years 7 months ago by kyratn.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2319
  • MODERATOR
3 years 7 months ago #239536

Hi,

You have to edit the file "plugins/hikashop/massaction_product/massaction_product.php" and replace the function "onProcessProductMassActionupdateCategories" by this code:

	function onProcessProductMassActionupdateCategories(&$elements,&$action,$k){
		$db = JFactory::getDBO();
		$ids = array();
		foreach($elements as $element){
			if(isset($element->categories)){
				if($action['type'] == 'add'){
					$element->categories = array_unique(array_merge($element->categories,$action['value']));
				}else{
					$element->categories = $action['value'];
				}
			}
			$ids[]=(int)$element->product_id;
		}
		$max = 500;
		if($action['type'] == 'remove'){
			$deleteQuery = 'DELETE FROM '.hikashop_table('product_category').' WHERE category_id IN('.implode(',',$action['value']).') AND product_id IN(';
			$deleteQuery = $deleteQuery . implode(',',$ids) .')';
			$db->setQuery($deleteQuery);
			$db->query();
		}else{
			$db->setQuery('SELECT * FROM '.hikashop_table('product_category').' WHERE product_id IN('.implode(',',$ids).')');
			$existing = $db->loadObjectList();
			$deleteQuery = 'DELETE FROM '.hikashop_table('product_category').' WHERE product_id IN(';
			$deleteIds = array();
			$insertQuery = 'INSERT INTO '.hikashop_table('product_category').' (category_id, product_id) VALUES';
			$insertValues = array();
			foreach($elements as $element){
				if($element->product_type != 'main') continue;
				if($action['type'] == 'replace'){
					$deleteIds[] = (int)$element->product_id;
				}
				if(!isset($action['value'])) continue;
				foreach($action['value'] as $k => $category){
					$insert = true;
					foreach($existing as $existingEntry){
						if($action['type'] == 'add' && $existingEntry->category_id == $category && $existingEntry->product_id == $element->product_id){
							$insert = false;
						}
					}
					if($insert){
						 $insertValues[] = '('.(int)$category.','.(int)$element->product_id.')';
					}
				}
			}
			if(!empty($deleteIds)){
				$deleteQuery = $deleteQuery . implode(',',$deleteIds) .')';
				$db->setQuery($deleteQuery);
				$db->query();
			}
			if(!empty($insertValues)){
				$insertQuery = $insertQuery . implode(',',$insertValues);
				$db->setQuery($insertQuery);
				$db->query();
			}
		}
	}

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum