This not being an already present feature frustrated me enough that i stayed up way too late to get it working, full disclaimer i am not at all experienced with php so this is just me trying my best over here. Anyway.
Start by adding two columns to your _shops table:
shoptalk (varchar 500), which will be our shop description, and
shopkeeper (varchar 150) which will be our NPC image.
In model/domainmodel/shop.php, add the following functions:
This lets us call the values for the NPC and shop description onto our shop's pages. Now to add them to the pages themselves.
In view/main/shopview.php, add the following under public function browse directly under $document->setTitle($shop->getShopname());
This adds the shopkeeper and shop description to the pages. By now that's really all you need to do to give shops their new customized facelift, but to make things easier let's add this to the ACP so that the shop NPC and description can be added and modified natively.
Go to controller/admincp/shopcontroller.php and add the following to public function add and public function edit. Preferably after description or imageurl but I'm not sure if it matters too much.
Now go over to view/admincp/shopview.php and add the following in public function add under $shopForm->buildDropdownList("existingimageurl", "ImageList");
and this in public function edit under $shopForm->buildDropdownList("existingimageurl", "ImageList", $shop->getImageURL());
And with that we're done. In the ACP when you go to add or edit a new shop you should have an additional box for adding an image url for the shop NPC and a box for some flavor text for the shop itself. Here's how things should look when you're all done.
In the ACP:
On the shop page itself:
Start by adding two columns to your _shops table:
shoptalk (varchar 500), which will be our shop description, and
shopkeeper (varchar 150) which will be our NPC image.
In model/domainmodel/shop.php, add the following functions:
PHP:
public function getTalk(){
return $this->shoptalk;
}
public function getShopKeeper(){
return $this->shopkeeper;
}
This lets us call the values for the NPC and shop description onto our shop's pages. Now to add them to the pages themselves.
In view/main/shopview.php, add the following under public function browse directly under $document->setTitle($shop->getShopname());
Code:
$document->addLangvar("<img src='{$shop->getShopKeeper()}'> <br><br>");
$document->addLangvar($shop->getTalk());
This adds the shopkeeper and shop description to the pages. By now that's really all you need to do to give shops their new customized facelift, but to make things easier let's add this to the ACP so that the shop NPC and description can be added and modified natively.
Go to controller/admincp/shopcontroller.php and add the following to public function add and public function edit. Preferably after description or imageurl but I'm not sure if it matters too much.
Code:
"shopkeeper" => $mysidia->input->post("shopkeeper"), "shoptalk" => $mysidia->input->post("shoptalk"),
Now go over to view/admincp/shopview.php and add the following in public function add under $shopForm->buildDropdownList("existingimageurl", "ImageList");
Code:
$shopForm->add(new Comment("Shopkeeper Image: ", FALSE));
$shopForm->add(new TextField("shopkeeper"));
$shopForm->add(new Comment("Shopkeeper Text:"));
$shopForm->add(new TextArea("shoptalk", "Here you can enter a shopkeeper's text for your shop", 4, 50));
and this in public function edit under $shopForm->buildDropdownList("existingimageurl", "ImageList", $shop->getImageURL());
Code:
$shopForm->add(new Comment("Shopkeeper Image: ", FALSE));
$shopForm->add(new TextField("shopkeeper", $shop->getShopKeeper()));
$shopForm->add(new Comment("Shopkeeper Text:"));
$shopForm->add(new TextArea("shoptalk", $shop->getTalk(), 4, 50));
And with that we're done. In the ACP when you go to add or edit a new shop you should have an additional box for adding an image url for the shop NPC and a box for some flavor text for the shop itself. Here's how things should look when you're all done.
In the ACP:
On the shop page itself:
Last edited: