Jump to content

tinybibiya

Members
  • Posts

    24
  • Joined

  • Last visited

1 Follower

Profile Information

  • First Name
    Sandra
  • Last Name
    Yin

Recent Profile Visitors

232 profile views

tinybibiya's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, Recently I have problem with this issue. I don't know why. Can please help me fix this? http://www.tinybibiya.com/login?back=my-account#account-creation What can I do? PrestaShop version 1.6.0.14 Server information Linux #1 SMP Fri Oct 21 09:45:54 EDT 2016 x86_64 Server software version LiteSpeed PHP version 7.0.19 Memory limit 256M Max execution time 30 Fatal error: Uncaught Error: Access to undeclared static property: Validate::$data in /home/lorybloo/public_html/tinybibiya.com/classes/ObjectModel.php:1067 Stack trace: #0 /home/lorybloo/public_html/tinybibiya.com/controllers/front/AuthController.php(409): ObjectModelCore->validateController() #1 /home/lorybloo/public_html/tinybibiya.com/controllers/front/AuthController.php(242): AuthControllerCore->processSubmitAccount() #2 /home/lorybloo/public_html/tinybibiya.com/classes/controller/Controller.php(171): AuthControllerCore->postProcess() #3 /home/lorybloo/public_html/tinybibiya.com/classes/Dispatcher.php(373): ControllerCore->run() #4 /home/lorybloo/public_html/tinybibiya.com/index.php(33): DispatcherCore->dispatch() #5 {main} thrown in /home/lorybloo/public_html/tinybibiya.com/classes/ObjectModel.php on line 1067
  2. I am using 1.6.0.14. override/controllers/front/ProductController.php add: $id_product = (int)Tools::getValue('id_product'); $warehouses = WarehouseCore::getWarehousesByProductId($id_product); $id_product_attribute = Db::getInstance()->ExecuteS(' SELECT pa.id_product_attribute id_pa, al.name name, CONCAT(w.reference, " - ", w.name) as wname, w.id_warehouse id_w FROM `ps_product_attribute` pa LEFT JOIN `ps_product_attribute_combination` pac ON (pa.`id_product_attribute` = pac.`id_product_attribute`) LEFT JOIN `ps_attribute` a ON (pac.`id_attribute` = a.`id_attribute`) LEFT JOIN `ps_attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`) LEFT JOIN `ps_stock` s ON (pa.`id_product_attribute` = s.`id_product_attribute`) LEFT JOIN `ps_warehouse` w ON (s.`id_warehouse` = w.`id_warehouse`) WHERE pa.`id_product` = '.(int)$id_product .' GROUP BY w.id_warehouse, pa.id_product_attribute ORDER BY w.reference, a.`position`'); $attributetable = array(); foreach ($id_product_attribute as $row) { $attributetable[] = array( "id_pa" => $row['id_pa'], "name" => $row['name'], "wname" => $row['wname'], "id_w" => $row['id_w'], "realqty" => ProductCore::getRealQuantity($id_product,$row['id_pa'],$row['id_w']) ); } $warehousetable = array(); foreach ($warehouses as $row) { $warehousetable[] = array( "name" => $row['name'], "warehouseQty" => ProductCore::getRealQuantity($id_product,null,$row['id_warehouse']) ); } $this->context->smarty->assign("attributetable",$attributetable); $this->context->smarty->assign("warehousetable",$warehousetable); themes/[your_theme]/product.tpl add anywhere you like. {foreach $warehousetable as $j} {if $j.warehouseQty != 0} <table> <thead> <tr> <th colspan="2">{$j.name}</th> </tr> </thead> <tbody> {foreach $attributetable as $item} {if $item.wname == $j.name} <tr> <td> {$item.name} {if $item.name == 'S' || $item.name == 'M' || $item.name == 'L' || $item.name == 'XL'}size{else}{/if} </td> <td> {if $item.realqty == 0}Out of Stock{else}{$item.realqty} {if $item.realqty == 1}item{else}items{/if}{/if} </td> </tr> {/if} {/foreach} </tbody> </table> <br> {/if} {/foreach} You will get a table for each warehouse, including showing each attribute of the product. Display attribute is out of stock if qty is 0, and hides the whole warehouse table if qty for all attribute is 0. Your table will look something like this: http://www.tinybibiya.com/lace-petti-romper/154-teal-lace-petti-romper-with-headband.html
  3. Hi, do you know how to show quantity for each attribute in each warehouse? The solution above sum all the quantity of all attributes into each warehouse. Example: Warehouse 1: size S (2) and M (2) Warehouse 2: size S (3) and M (5) The product page will show: #W1 - Warehouse 1 (4) #W2 - Warehouse 2 (8) Would like to show quantity of each attribute when while changing attributes in product page.
  4. I am trying to create a similar button in Back office Order Detail that registers the tracking number of the order. Basically this new button + form is a warehouse order id that I want to keep as a record for each order, besides the courier tracking number. I have created a new column in the database in ps_orders (id_isis_order) and ps_order_carrier (id_wh_order). i have attached the screen shot. I have also changed the tpl to have the form in place. Name of the button will be submitWarehouseNumber. As for the controller side, i copy and edit the variables to my own database name, I'm not sure if I am going it right or not? Will this work? if (Tools::isSubmit('submitWarehouseNumber') && isset($order)) { if ($this->tabAccess['edit'] === '1') { $order_carrier = new OrderCarrier(Tools::getValue('id_order_carrier')); // update shipping number // Keep these two following lines for backward compatibility, remove on 1.6 version $order->id_isis_order = Tools::getValue('id_wh_order'); $order->update(); // Update order_carrier $order_carrier->id_wh_order = pSQL(Tools::getValue('id_wh_order')); if ($order_carrier->update()) { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order, 'customer' => $customer, 'carrier' => $carrier), null, false, true, false, $order->id_shop); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); } else $this->errors[] = Tools::displayError('The order carrier cannot be updated.'); } else $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } Do I need to change anything for this line? Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order, 'customer' => $customer, 'carrier' => $carrier), null, false, true, false, $order->id_shop); I cannot find the name 'actionAdminOrdersTrackingNumberUpdate' in database. So not sure if I should create a new name for this new button.
  5. Solve: Need to change in BO Preference -> Performance: Recompile templates if the files have been updated
  6. Hi, I have created StocklistController.php in /public_html/controllers/front I also have created stocklist.tpl in /public_html/themes/[my_theme] It suppose to display the values at tpl but is not showing. What am I missing? php: <?php class StocklistControllerCore extends FrontController { public $php_self = 'stocklist'; public function initContent() { parent::initContent(); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT (cp.position + 1) no, cl.name tb_category, MAX(IF(fp.id_feature = 11, fvl.value, NULL)) tb_type, p.reference tb_sku, MAX(IF(fp.id_feature = 13, fvl.value, NULL)) prod_color_name, MAX(IF(a.id_attribute = 4, pq.quantity, NULL)) free_size, MAX(IF(a.id_attribute = 1, pq.quantity, NULL)) s_size, MAX(IF(a.id_attribute = 2, pq.quantity, NULL)) m_size, MAX(IF(a.id_attribute = 3, pq.quantity, NULL)) l_size, MAX(IF(a.id_attribute = 25, pq.quantity, NULL)) xl_size FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_feature_product fp ON (pa.id_product = fp.id_product) LEFT JOIN ps_feature_value_lang fvl ON (fp.id_feature_value = fvl.id_feature_value) LEFT JOIN ps_stock_available pq ON (p.id_product = pq.id_product AND pa.id_product_attribute = pq.id_product_attribute) LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_attribute a ON (pac.id_attribute = a.id_attribute) LEFT JOIN ps_attribute_lang pal ON (pac.id_attribute = pal.id_attribute) LEFT JOIN ps_category_product cp ON (p.id_category_default = cp.id_category AND p.id_product = cp.id_product) LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category) LEFT JOIN ps_category c ON (cp.id_category = c.id_category) LEFT JOIN ps_category_shop cs ON (cp.id_category = cs.id_category) WHERE pl.id_lang = 1 AND (p.id_category_default = 15 OR p.id_category_default = 31 OR p.id_category_default = 17 OR p.id_category_default = 16) AND (fp.id_feature = 13 OR fp.id_feature = 11) GROUP BY p.id_product ORDER BY c.id_parent, cs.position,cp.position, a.position'); $quantitytable = array(); foreach ($result as $row) { $quantitytable[] = array( "no" => $row['no'], "tb_category" => $row['tb_category'], "tb_type" => $row['tb_type'], "tb_sku" => $row['tb_sku'], "prod_color_name" => $row['prod_color_name'], "free_size" => $row['free_size'], "s_size" => $row['s_size'], "m_size" => $row['m_size'], "l_size" => $row['l_size'], "xl_size" => $row['xl_size'] ); } $this->context->smarty->assign("quantitytable", $quantitytable); $this->setTemplate(_PS_THEME_DIR_.'stocklist.tpl'); } } tpl: <h1>Testpage Test123</h1> <p>Testing</p> <ul> {foreach $quantitytable as $item} <li>{$item.s_size}</li> {/foreach} </ul> When I use this table no problem, can see the value in tpl: $result = Db::getInstance()->ExecuteS('SELECT id_product, id_product_attribute, quantity FROM ps_stock_available WHERE id_product_attribute <> "0"'); $quantitytable = array(); foreach ($result as $row) { $quantitytable[] = array( "id_product" => $row['id_product'], "id_prod_attr" => $row['id_product_attribute'], "quantity" => $row['quantity'] ); } $this->context->smarty->assign("quantitytable", $quantitytable); I managed to display all values.
  7. Try referring this topic. i managed to get it done and display the values from my database to my custom page. https://www.prestashop.com/forums/topic/345759-get-data-from-db-in-tpl/ You need 2 files. Your tpl put in /public_html/themes/[your_theme] Your php put in /public_html/controllers/front You also need to create a page in Preferences -> SEO & URLs. Once you put in the two files in your ftp with the correct class name, the option for you to choose to make a page is there.
  8. Hi, I am using PS1.6.0.14. I have a product that has 3 attributes. Example: 1) No headband 2) Simple Headband 3) Fancy Headband I want to have all my products that has the attribute 'simple headband' to get a discount when customer buy 2 product with 'simple headband' option. I have configured the catalog price rules as if qty is more than 2, and condition is attribute is 'simple headband', will get some discount. Lets say customer bought 2 product and puts in the cart: Product A + 'no headband' and Product A + 'simple headband' Total item in cart is 2. The problem is prestashop considers my qty as 2 even though there is only 1 product with 'simple headband'. The cart gives the product with simple headband a discount although the total product with simple headband is 1. its suppose to have 2 products + 'simple heabband' then only the discount works. The other product with 'no headband' remains as it is with no discount (correct). Is this a bug? How can i solve it?
  9. OK. Can I put this code into controller php? <?php class StocklistControllerCore extends FrontController { public $php_self = 'stocklist'; public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'stocklist.tpl'); $sql = 'SELECT p.'id_product', GROUP_CONCAT(DISTINCT(cl.'name') SEPARATOR ","), pa.'reference', pl.'name', GROUP_CONCAT(DISTINCT(pal.'name') SEPARATOR ", "), pq.'quantity' FROM `'._DB_PREFIX_.'product' p LEFT JOIN `'._DB_PREFIX_.'product_attribute' pa ON p.'id_product' = pa.'id_product' LEFT JOIN `'._DB_PREFIX_.'stock_available' pq ON p.'id_product' = pq.'id_product' AND pa.'id_product_attribute' = pq.'id_product_attribute' LEFT JOIN `'._DB_PREFIX_.'product_lang' pl ON (p.'id_product' = pl.'id_product' LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination' pac ON (pa.'id_product_attribute' = pac.'id_product_attribute' LEFT JOIN `'._DB_PREFIX_.'attribute_lang pal' ON (pac.'id_attribute' = pal.'id_attribute' LEFT JOIN `'._DB_PREFIX_.'category_product' cp ON (p.'id_category_default' = cp.'id_category' LEFT JOIN `'._DB_PREFIX_.'category_lang' cl ON (cp.'id_category' = cl.'id_category' LEFT JOIN `'._DB_PREFIX_.'category' c ON cp.'id_category' = c.'id_category' WHERE pl.'id_lang' = 1 AND pal.'id_lang' = 1 AND p.'id_category_default' = 15 GROUP BY 'pa.reference' ORDER BY 'p.id_product', 'pac.id_attribute' $res = Db::getInstance()->executeS($sql); } } If I am doing the controller part right, how can I display the whole table at Front Office stocklist.tpl?
  10. Hi, I'm using PS 1.6. I've managed to create a new blank page using php. My files are: 1) root/controller/front/StocklistController.php <?php class StocklistControllerCore extends FrontController { public $php_self = 'stocklist'; public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'stocklist.tpl'); } } 2) root/themes/*my theme*/stocklist.tpl {include file="$tpl_dir./breadcrumb.tpl"} {include file="$tpl_dir./errors.tpl"} <h1>Testpage</h1> Now, I want to know how to grab data from database. I already have a nice table using the SQL manager module in the BO as seen in picture attachment. How to translate this query into php format? I may need to output Reference #, Name, Size Variation, and Quantity into the front end tpl file. SELECT p.id_product as 'ID', GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") as 'Category', pa.reference as 'Reference #', pl.name as 'Name', GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR ", ") as 'Size Variation', pq.quantity as 'Quantity' FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_stock_available pq ON (p.id_product = pq.id_product AND pa.id_product_attribute = pq.id_product_attribute) LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_attribute_lang pal ON (pac.id_attribute = pal.id_attribute) LEFT JOIN ps_category_product cp ON (p.id_category_default = cp.id_category) LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category) LEFT JOIN ps_category c ON (cp.id_category = c.id_category) WHERE pl.id_lang = 1 AND pal.id_lang = 1 AND p.id_category_default = 15 GROUP BY pa.reference ORDER BY p.id_product, pac.id_attribute Thanks in advance tinybibiya
  11. Hi, Can you teach me? I am trying to get some data from database and display my stock count for dropshippers to view in 1 glance instead of checking in each product list. [email protected]
  12. It doesn't work for 'in_transit' Tried for 'preparation'.. that worked.
  13. Hi, I want to create a page that is only limit to a certain customer group. I wish to create a page like CMS page, but i want to grab data from the DB and it will auto display in that page. I want to create a page for my dropshippers to see the stock list, so they don't have to go in to each product listing to check on the stock availability. The current table that I have in my SQL Manager is as below: SELECT p.id_product as 'ID', GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") as 'Category', pa.reference as 'Reference #', pl.name as 'Name', GROUP_CONCAT(DISTINCT(pal.name) SEPARATOR ", ") as 'Size Variation', pq.quantity as 'Quantity' FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_stock_available pq ON (p.id_product = pq.id_product AND pa.id_product_attribute = pq.id_product_attribute) LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_attribute_lang pal ON (pac.id_attribute = pal.id_attribute) LEFT JOIN ps_category_product cp ON (p.id_category_default = cp.id_category) LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category) LEFT JOIN ps_category c ON (cp.id_category = c.id_category) WHERE pl.id_lang = 1 AND pal.id_lang = 1 AND p.id_category_default = 15 GROUP BY pa.reference ORDER BY p.id_product, pac.id_attribute And I wish to make it display in a nice table. Example: Romper Color 1. White 2S 2M 2L 2. Cream 2S 4M 5L etc. .. . . Can anyone help the basic to get data from the DB and post in front office?
  14. Can I put the {invoice_block_html} variables via BO-> translation -> email template? Can work for 'in transit'? Cuz i tried cannot work. I'm using own theme. What is the method?
  15. Sorry. I put Disable all overrides as NO. Already done that. Still cannot. Now I have to rely on hardcoding.
×
×
  • Create New...