NamelessMC

Internet Explorer

Internet Explorer is not supported. Please upgrade to a more modern browser.

Tebex Store Error
Started by LazyChazy

LazyChazy

LazyChazy

Member
Joined
11 May 2021
Last Seen
07 Jun 2022
Topics
2
Posts
3

Uncaught TypeError

count(): Argument #1 ($value) must be of type Countable|array, string given

(File: /home/boxsmpxy/domains/ravenhide.xyz/public_html/modules/Tebex/pages/store/category.php)

<span class="token php language-php" style="box-sizing: border-box;"><span class="token delimiter important" style="box-sizing: border-box; font-weight: normal;"><?php </span>
<span class="token comment" style="box-sizing: border-box; color: #7d8b99;">/*
 *	Made by Samerton
 *  https://github.com/NamelessMC/Nameless/
 *  NamelessMC version 2.0.0-pr6
 *
 *  License: MIT
 *
 *  Store page - category view
 */</span>

<span class="token comment" style="box-sizing: border-box; color: #7d8b99;">// Always define page name</span>
<span class="token function" style="box-sizing: border-box; color: #2f9c0a;">define</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'PAGE'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">,</span> <span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'buycraft'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>

<span class="token comment" style="box-sizing: border-box; color: #7d8b99;">// Get category ID</span>
<span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span> <span class="token operator" style="box-sizing: border-box;">=</span> <span class="token function" style="box-sizing: border-box; color: #2f9c0a;">explode</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'/'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">,</span> <span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$route</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
<span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span> <span class="token operator" style="box-sizing: border-box;">=</span> <span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">[</span><span class="token function" style="box-sizing: border-box; color: #2f9c0a;">count</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span> <span class="token operator" style="box-sizing: border-box;">-</span> <span class="token number" style="box-sizing: border-box; color: #c92c2c;">1</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">]</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>

<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">if</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token operator" style="box-sizing: border-box;">!</span><span class="token keyword" style="box-sizing: border-box; color: #1990b8;">isset</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">[</span><span class="token function" style="box-sizing: border-box; color: #2f9c0a;">count</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span> <span class="token operator" style="box-sizing: border-box;">-</span> <span class="token number" style="box-sizing: border-box; color: #c92c2c;">1</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">]</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">{</span>
	<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">require_once</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token constant" style="box-sizing: border-box; color: #c92c2c;">ROOT_PATH</span> <span class="token operator" style="box-sizing: border-box;">.</span> <span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'/404.php'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
	<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">die</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
<span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">}</span>

<span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span> <span class="token operator" style="box-sizing: border-box;">=</span> <span class="token function" style="box-sizing: border-box; color: #2f9c0a;">explode</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'-'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">,</span> <span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">if</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token operator" style="box-sizing: border-box;">!</span><span class="token function" style="box-sizing: border-box; color: #2f9c0a;">is_numeric</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">[</span><span class="token number" style="box-sizing: border-box; color: #c92c2c;">0</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">]</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">{</span>
	<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">require_once</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token constant" style="box-sizing: border-box; color: #c92c2c;">ROOT_PATH</span> <span class="token operator" style="box-sizing: border-box;">.</span> <span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'/404.php'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
	<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">die</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
<span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">}</span>
<span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span> <span class="token operator" style="box-sizing: border-box;">=</span> <span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">[</span><span class="token number" style="box-sizing: border-box; color: #c92c2c;">0</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">]</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>

<span class="token comment" style="box-sizing: border-box; color: #7d8b99;">// Query category</span>
<span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category</span> <span class="token operator" style="box-sizing: border-box;">=</span> <span class="token class-name static-context" style="box-sizing: border-box; color: #1990b8;">DB</span><span class="token operator" style="box-sizing: border-box;">::</span><span class="token function" style="box-sizing: border-box; color: #2f9c0a;">getInstance</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token operator" style="box-sizing: border-box;">-></span><span class="token function" style="box-sizing: border-box; color: #2f9c0a;">query</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'SELECT categories.id AS id, categories.name AS name, categories.parent_category AS parent_category, descriptions.description AS description, descriptions.image AS image FROM nl2_buycraft_categories AS categories LEFT JOIN nl2_buycraft_categories_descriptions AS descriptions ON descriptions.category_id = categories.id WHERE categories.id = ?'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">,</span> <span class="token keyword" style="box-sizing: border-box; color: #1990b8;">array</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category_id</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>

<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">if</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token operator" style="box-sizing: border-box;">!</span><span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category</span><span class="token operator" style="box-sizing: border-box;">-></span><span class="token function" style="box-sizing: border-box; color: #2f9c0a;">count</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">{</span>
	<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">require_once</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token constant" style="box-sizing: border-box; color: #c92c2c;">ROOT_PATH</span> <span class="token operator" style="box-sizing: border-box;">.</span> <span class="token string single-quoted-string" style="box-sizing: border-box; color: #2f9c0a;">'/404.php'</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
	<span class="token keyword" style="box-sizing: border-box; color: #1990b8;">die</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span>
<span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">}</span>

<span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category</span> <span class="token operator" style="box-sizing: border-box;">=</span> <span class="token variable" style="box-sizing: border-box; color: #a67f59; background: rgba(255, 255, 255, 0.5);">$category</span><span class="token operator" style="box-sizing: border-box;">-></span><span class="token function" style="box-sizing: border-box; color: #2f9c0a;">first</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">(</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #5f6364;">;</span></span></span>
LazyChazy · 8 months ago
Horatiu

Horatiu

Member
Joined
01 May 2020
Last Seen
02 Oct 2022
Topics
3
Posts
19

Hi @LazyChazy!

If you use a custom panel template, probably this is not compatible with Tebex addon. Try to use default NamelessMC panel template and see if you receive this error again.

Contact me on email [email protected] - Or join on my Discord!
© 2019-2022 SuperHori.Com - Resources developed with ? and passion in Romania!

Horatiu · 8 months ago