• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Myaac add new categorys

almirtibiaalmir

New Member
Joined
Jan 9, 2010
Messages
48
Reaction score
3
Hello,

i would add new category example "support items" on myaac. I tryed to add on gift.php, admin-offers-add.html.twig and in database but on Admin Panel are the category but there is no possibility to add the item id and count.




admin-offers-add.html.twig:

if(value === 'item') {
$('#extra').append('<div class="input-group"><input class="form-control" type="number" name="item_id" min="100" placeholder="Item ID" required/><input class="form-control" type="number" name="item_count" min="1" max="100" placeholder="Item Count" required/></div>');
} else if(value === 'support items') {
$('#extra').append('<div class="input-group"><input class="form-control" type="number" name="item_id" min="100" placeholder="Item ID" required/><input class="form-control" type="number" name="item_count" min="1" max="100" placeholder="Item Count" required/></div>');
} else if(value === 'container') {
$extra.append('<div class="input-group"><input class="form-control" type="number" name="item_id" min="100" placeholder="Item ID" required/><input class="form-control" type="number" name="item_count" min="1" max="100" placeholder="Item Count" required/></div><br/>');
} else if(value === 'addon') {
$extra.append('<div class="input-group"><input class="form-control" type="number" name="look_female" min="1" placeholder="Female (girl) Look Type" required/><input class="form-control" type="number" name="addons_female" min="1" max="3" placeholder="Female Addons (1, 2 or 3 for both)" required/></div><br/>');
$extra.append('<div class="input-group"><input class="form-control" type="number" name="look_male" min="1" placeholder="Male (boy) Look Type" required/><input class="form-control" type="number" name="addons_male" min="1" max="3" placeholder="Male Addons (1, 2 or 3 for both)" required/></div>');
} else if(value === 'mount') {
$extra.append('<input class="form-control" type="number" name="mount_id" min="1" placeholder="Mount ID (take from mounts.xml)" required/>');
} else if(value === 'pacc') {
$extra.append('<input class="form-control" type="number" name="days" min="1" placeholder="Premium Days" required/>');
}
}
</script>

gifts.php

switch($offer_type) {
case 'item':
$itemid1 = isset($_REQUEST['item_id']) ? $_REQUEST['item_id'] : null;
$count1 = isset($_REQUEST['item_count']) ? $_REQUEST['item_count'] : null;
if(!$itemid1 || !is_numeric($itemid1)) {
$errors[] = 'Please fill all fields. Item ID is empty or its not a number.';
}
else if(!$count1 || !is_numeric($count1)) {
$errors[] = 'Please fill all fields. Item Count is empty or its not a number.';
}

break;

case 'support items':
$itemid1 = isset($_REQUEST['item_id']) ? $_REQUEST['item_id'] : null;
$count1 = isset($_REQUEST['item_count']) ? $_REQUEST['item_count'] : null;
if(!$itemid1 || !is_numeric($itemid1)) {
$errors[] = 'Please fill all fields. Item ID is empty or its not a number.';
}
else if(!$count1 || !is_numeric($count1)) {
$errors[] = 'Please fill all fields. Item Count is empty or its not a number.';
 

Attachments

You are missing some parts in the code.

1. In system/libs/shop-system.php

In function

Code:
private static function parseOffer($_offer) {

After:
Code:
case 'item':

Add
Code:
case 'support items';

2. In system/templates/gesior-shop-system/gifts.html.twig

Change:
Code:
{% if offer.type == "item" or offer.type == "container" %}

To:
Code:
{% if offer.type == "item" or offer.type == "container" or offer.type == "support items" %}

3. In system/pages/gifts.php

Change:
Code:
if($item_type == "item" || $item_type == "container") {

To:
Code:
if($item_type == "item" || $item_type == "container" || $item_type == "support items") {

I think I didn't missed anything.

Also make sure your offer is not hidden, you can do that by checking in phpmyadmin z_shop_offer table - "hidden" should be 0.

1668335918582.png
 
Might be stupid question, but did you cleared cache in admin panel after that change in admin-offers-add.html.twig?

This is supposed to display that itemid fields.

Another thing worth noticing, did you wrote that same in database? I mean case-sensitive, like this? (notice the small letters)

1668545005127.png
 
If you wish, I can try to help you through team viewer, because without seeing the code and changes you did, its hard to judge.

If you want - write me on discord: slawkens#7932
Post automatically merged:

ok so the problem was with the twig cache not being refreshed in admin panel
explained through team viewer
 
Last edited:
Back
Top