Jump to content

dev123

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

1,590 profile views

dev123's Achievements

Newbie

Newbie (2/6)

2

Reputation

  1. Delving deeper in the module code CREATE TABLE {$this->className} ( session_id VARCHAR(255) NULL, last_modified TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, items TEXT NULL, total_sum FLOAT(10,2) NULL, user_id INT NULL, PRIMARY KEY (`session_id`) ) class ShoppingCart extends WireData implements Module, ConfigurableModule it turns for that this code creates a table with name 'shoppingcart' instead of 'ShoppingCart' when run on my local wamp machine, but when run directly on my server xamp it creates 'ShoppingCart'. And i got the problme because i ported from my local to server machine, so carried 'shoppingcart' table , which when called on local machine worked surprsiingly for some reason but on server its case-sensitive.
  2. That actually was the problem apesia.Thanks a lot ! ..But what actually shocks me is how that worked on the local machine in the first place.The table names come from : $update = $this->db->query("UPDATE {$this->className} SET items = '$items', total_sum = $total_sum WHERE session_id = '" . $this->getSession() . "'"); class ShoppingCart extends WireData implements Module, ConfigurableModule
  3. When i work on development server locally renderCart() and renderAddToCart() functions throw no errors and perfectly as they should. Even when i install modules on server directly, they do work. But when i develop locally and then port the project to a domain on server somewhere else on the internet , my functions throw up errors even though rest of processwire pages work fine. Below is error thrown, where renderCart() function is called.On dev local system it shows 'No items in cart' This error occurs when clicked on add to cart : Pls help!!!
  4. <?php class Helloworld extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hello World', 'version' => 101, 'summary' => 'An example module used for demonstration purposes. See the /site/modules/Helloworld.module file for details.', 'href' => 'http://www.processwire.com', 'singular' => true, 'autoload' => true, ); } public function init() { $this->pages->addHookBefore('trash', $this, 'example5'); } public function example5($event){ if ($this->skipme) return; $this->message("TRASHed"); $this->skipme=true; } For some reason this example 5 function was running twice on trashing one page ...So this solved my problem .But i still dont get it why is it running twice
  5. public static function getModuleInfo() { return array( 'title' => 'Hello World', 'version' => 101, 'summary' => 'An example module used for demonstration purposes. See the /site/modules/Helloworld.module file for details.', 'href' => 'http://www.processwire.com', 'singular' => true, 'autoload' => true, ); } public function init() { $this->pages->addHookAfter('trash', $this, 'example5'); } public function example5($event){ $this->message("TRASHed"); } I just edited helloworld module to add hook after trash ...I have succesfully added hook after save, but this after trash hook doesnt seem to work for me . Pls guide where am i goin wrong . What happens is when i delete a page(added to trash), this message "TRASHed " appears twice as in the snapshot.
  6. public static function getModuleInfo() { return array( 'title' => 'Hello World', 'version' => 101, 'summary' => 'An example module used for demonstration purposes. See the /site/modules/Helloworld.module file for details.', 'href' => 'http://www.processwire.com', 'singular' => true, 'autoload' => true, ); } public function init() { $this->pages->addHookAfter('trash', $this, 'example5'); } public function example5($event){ $this->message("TRASHed"); } I just edited helloworld module to add hook after trash ...I have succesfully added hook after save, but this after trash hook doesnt seem to work for me . Pls guide where am i goin wrong . What happens is when i delete a page(added to trash), this message "TRASHed " appears twice as in the snapshot.
  7. @horst ..you were bang on ! ..the problem was that my php code in templates wasn't by default getting encoded as utf-8 and to add to it, even my csv were not utf-8 encoded. no headers required, i am able to add all special characters via csv import now..thanks a ton! And yes, i'll be careful about adding code next time onwards !
  8. horst..i even tried this now...skipping the csv thing entirely as in this example: i.e. I just tried to create a page via api and gave it the title "The smørrebrød"..still it doesnt get stored, the title after "The sm" gets truncated as it comes accross a special character. And as before same thing works if done via admin.
  9. This is my .htaccess This is my csv which i used for import When i just read csv using code: and output it in browser it showd this:(special characters are shown with question mark in diamond) when i added this line to my code : header('Content-Type: text/html; charset=iso-8859-1'); Webpage output: So now i know that webpage is reading my special characters , but then when i import even using header line in processwire as in this code: The import stops at special characters : pls help!!So no matter how muchever i try i am unable to add text with special characters into processwire using api Note: the same works when i jus copy the word with special character and add the page via admin
×
×
  • Create New...