Can't get hidden shop to work...

Forum
Last Post
Threads / Messages

Mortain

***** SpottedMare.com
Member
Joined
Nov 12, 2015
Messages
80
Points
0
Mysidian Dollar
6,130
I'm making a shop that you need an item to go to the link's page to get to the shop.

buy item>Get link>Use item>go to page with shop link> Go to shop (in that order.)

When i try to directly access the shop, it tosses this error.

Catchable fatal error: Argument 2 passed to AppController::setField() must implement interface Resource\Native\Objective, boolean given, called in /home/nirainia/public_html/adopts/shop.php on line 33 and defined in /home/nirainia/public_html/adopts/classes/class_appcontroller.php on line 169
 
The reason why you are getting this error is that the shop does not exist, which is why the variable $shop is Null rather than a valid Shop object.

And did you do all these via Admin control panel? Or you modified the script file? In the former case, I will investigate into this issue and help you as much as I can.
 
Well can you tell me how you made this in ACP? I dont recall doing anything like this myself, it seems that you are using this script in a really creative way. So please describe in more details, and I will try to reproduce the same error on my demo site, and then I can help you.
 
go to shops...
Fill out all pertinent data (name, type - adoptable, category - named after shop name)
Find image already uploaded.
make shop hidden
Add 9% sales tax
 
I see, but it seems to me that the system cannot find the shop for you, so either it is not created properly, or that it is not loading from database when you browse it. Can you go to PhpMyAdmin to check your database's table adopts_shops and see if the shop exists as a record? If so, it means that the hidden shop is not loaded from database, and I will see what I can do.
 
sorry about earlier, I had to run out the door to a doctors apointment.

Yes, the shop is in the database. I think this is hailing back to the problem of when i tried to install the item drop. it altered the DB some how to where things aren't showing (pets included)
 
I understand, I figured out what might be the issue for you. In fact it is the desired behavior, since if you can access a hidden shop by it's name, it's no longer really hidden. Think about this, the clever users may be able to find out the name of the shop, or they can simply exchange information. This is why by default, a hidden shop cannot be accessed by simply entering it's name from URL query string.

However, if you want the hidden shops to behave this way, I can make it happen for you. All you need is a single line edit in class shoplist. Lemme know if you want that, and I will show you the code to change.
 
well what i really want, is an item that gives a one time access to the shop per item use. Different items different colors will access different shops. that was the end goal. but there's really no way to do that.
 
Last edited:
I see, I dont think this is possible without some kind of modification to the script. You can find a list of item functions available from admin control panel, and I dont recall access to a hidden shop is one of the functionality in the default package. You can, however, enable one-time access to a custom page per item use. So there is a way to work around, as you can just create a custom page and put the link to your shop in this page.

But anyway, if you want to access a hidden shop(or any shop) by the shopname, you can change this block of code(the browse method) in shop.php:

PHP:
    public function browse(){
        $mysidia = Registry::get("mysidia");        
        $shoptype = $mysidia->db->select("shops", array("shoptype"), "shopname = '{$mysidia->input->get("shop")}'")->fetchColumn();
        $shoplist = new Shoplist($shoptype);
        $shop = $shoplist->createshop($mysidia->input->get("shop"));
        $this->setField("shop", $shop);
    }
To this:

PHP:
    public function browse(){
        $mysidia = Registry::get("mysidia");        
        $shoptype = $mysidia->db->select("shops", array("shoptype"), "shopname = '{$mysidia->input->get("shop")}'")->fetchColumn();
        $shoplist = new Shoplist($shoptype, "all");
        $shop = $shoplist->createshop($mysidia->input->get("shop"));
        $this->setField("shop", $shop);
    }
This will create a shoplist object with fetchmode 'all', which will find even hidden shops for you. Hope it solves your problem with hidden shop display.
 
alright, give that a try when you have a chance, I am not sure if this is the desired behavior you are looking for, but at least it will make a hidden shop accessible so long as you know its name.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,278
Messages
33,127
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top