/** * Debug helper method. * Access through : /shoppingcart/debug/ */ public function debug() { $html = EcommerceTaskDebugCart::debug_object($this); return $html; }
/** * Debug helper method. * Can be called from /shoppingcart/debug/ * @return String */ public function debug() { $this->calculateOrderAttributes(true); return EcommerceTaskDebugCart::debug_object($this); }
/** * Debug helper method. * Can be called from /shoppingcart/debug/ * @return String */ public function debug() { return EcommerceTaskDebugCart::debug_object($this); }
public function debug() { $member = Member::currentUser(); if (!$member || !$member->IsShopAdmin()) { $messages = array('default' => 'You must login as an admin to use debug functions.'); Security::permissionFailure($this, $messages); } $this->ProductsShowable(); $html = EcommerceTaskDebugCart::debug_object($this->dataRecord); $html .= "<ul>"; $html .= "<li><hr /><h3>Available options</h3><hr /></li>"; $html .= "<li><b>Sort Options for Dropdown:</b><pre> " . print_r($this->getUserPreferencesOptionsForDropdown("SORT"), 1) . "</pre> </li>"; $html .= "<li><b>Filter Options for Dropdown:</b><pre> " . print_r($this->getUserPreferencesOptionsForDropdown("FILTER"), 1) . "</pre></li>"; $html .= "<li><b>Display Styles for Dropdown:</b><pre> " . print_r($this->getUserPreferencesOptionsForDropdown("DISPLAY"), 1) . "</pre> </li>"; $html .= "<li><hr /><h3>Selection Setting (what is set as default for this page)</h3><hr /></li>"; $html .= "<li><b>MyDefaultFilter:</b> " . $this->getMyUserPreferencesDefault("FILTER") . " </li>"; $html .= "<li><b>MyDefaultSortOrder:</b> " . $this->getMyUserPreferencesDefault("SORT") . " </li>"; $html .= "<li><b>MyDefaultDisplayStyle:</b> " . $this->getMyUserPreferencesDefault("DISPLAY") . " </li>"; $html .= "<li><b>MyNumberOfProductsPerPage:</b> " . $this->MyNumberOfProductsPerPage() . " </li>"; $html .= "<li><b>MyLevelOfProductsToshow:</b> " . $this->MyLevelOfProductsToShow() . " = " . (isset($this->showProductLevels[$this->MyLevelOfProductsToShow()]) ? $this->showProductLevels[$this->MyLevelOfProductsToShow()] : "ERROR!!!! \$this->showProductLevels not set for " . $this->MyLevelOfProductsToShow()) . " </li>"; $html .= "<li><hr /><h3>Current Settings</h3><hr /></li>"; $html .= "<li><b>Current Sort Order:</b> " . $this->getCurrentUserPreferences("SORT") . " </li>"; $html .= "<li><b>Current Filter:</b> " . $this->getCurrentUserPreferences("FILTER") . " </li>"; $html .= "<li><b>Current display style:</b> " . $this->getCurrentUserPreferences("DISPLAY") . " </li>"; $html .= "<li><hr /><h3>DATALIST: totals, numbers per page etc</h3><hr /></li>"; $html .= "<li><b>Total number of products:</b> " . $this->TotalCount() . " </li>"; $html .= "<li><b>Is there more than one product:</b> " . ($this->TotalCountGreaterThanOne() ? "YES" : "NO") . " </li>"; $html .= "<li><b>Number of products per page:</b> " . $this->MyNumberOfProductsPerPage() . " </li>"; $html .= "<li><hr /><h3>SQL Factors</h3><hr /></li>"; $html .= "<li><b>Default sort SQL:</b> " . print_r($this->getUserSettingsOptionSQL("SORT"), 1) . " </li>"; $html .= "<li><b>User sort SQL:</b> " . print_r($this->getUserSettingsOptionSQL("SORT", $this->getCurrentUserPreferences("SORT")), 1) . " </li>"; $html .= "<li><b>Default Filter SQL:</b> <pre>" . print_r($this->getUserSettingsOptionSQL("FILTER"), 1) . "</pre> </li>"; $html .= "<li><b>User Filter SQL:</b> <pre>" . print_r($this->getUserSettingsOptionSQL("FILTER", $this->getCurrentUserPreferences("FILTER")), 1) . "</pre> </li>"; $html .= "<li><b>Buyable Class name:</b> " . $this->getBuyableClassName() . " </li>"; $html .= "<li><b>allProducts:</b> " . print_r(str_replace("\"", "`", $this->allProducts->sql()), 1) . " </li>"; $html .= "<li><hr /><h3>Search</h3><hr /></li>"; $resultArray = explode(",", Session::get($this->SearchResultsSessionVariable(false))); $productGroupArray = explode(",", Session::get($this->SearchResultsSessionVariable(true))); $html .= "<li><b>Is Search Results:</b> " . ($this->IsSearchResults() ? "YES" : "NO") . " </li>"; $html .= "<li><b>Products In Search (session variable : " . $this->SearchResultsSessionVariable(false) . "):</b> " . print_r($resultArray, 1) . " </li>"; $html .= "<li><b>Product Groups In Search (session variable : " . $this->SearchResultsSessionVariable(true) . "):</b> " . print_r($productGroupArray, 1) . " </li>"; $html .= "<li><hr /><h3>Other</h3><hr /></li>"; if ($image = $this->BestAvailableImage()) { $html .= "<li><b>Best Available Image:</b> <img src=\"" . $image->Link . "\" /> </li>"; } $html .= "<li><b>BestAvailableImage:</b> " . ($this->BestAvailableImage() ? $this->BestAvailableImage()->Link : "no image available") . " </li>"; $html .= "<li><b>Is this an ecommerce page:</b> " . ($this->IsEcommercePage() ? "YES" : "NO") . " </li>"; $html .= "<li><hr /><h3>Related Groups</h3><hr /></li>"; $html .= "<li><b>Parent product group:</b> " . ($this->ParentGroup() ? $this->ParentGroup()->Title : "[NO PARENT GROUP]") . "</li>"; $childGroups = $this->ChildGroups(99); if ($childGroups->count()) { $childGroups = $childGroups->map("ID", "MenuTitle"); $html .= "<li><b>Child Groups (all):</b><pre> " . print_r($childGroups, 1) . " </pre></li>"; } else { $html .= "<li><b>Child Groups (full tree): </b>NONE</li>"; } $html .= "<li><b>a list of Product Groups that have the products for the CURRENT product group listed as part of their AlsoShowProducts list:</b><pre>" . print_r($this->ProductGroupsFromAlsoShowProducts()->map("ID", "Title")->toArray(), 1) . " </pre></li>"; $html .= "<li><b>the inverse of ProductGroupsFromAlsoShowProducts:</b><pre> " . print_r($this->ProductGroupsFromAlsoShowProductsInverse()->map("ID", "Title")->toArray(), 1) . " </pre></li>"; $html .= "<li><b>all product parent groups:</b><pre> " . print_r($this->ProductGroupsParentGroups()->map("ID", "Title")->toArray(), 1) . " </pre></li>"; $html .= "<li><hr /><h3>Product Example and Links</h3><hr /></li>"; $product = Product::get()->filter(array("ParentID" => $this->ID))->first(); if ($product) { $html .= "<li><b>Product View:</b> <a href=\"" . $product->Link() . "\">" . $product->Title . "</a> </li>"; $html .= "<li><b>Product Debug:</b> <a href=\"" . $product->Link("debug") . "\">" . $product->Title . "</a> </li>"; $html .= "<li><b>Product Admin Page:</b> <a href=\"" . "/admin/pages/edit/show/" . $product->ID . "\">" . $product->Title . "</a> </li>"; $html .= "<li><b>ProductGroup Admin Page:</b> <a href=\"" . "/admin/pages/edit/show/" . $this->ID . "\">" . $this->Title . "</a> </li>"; } else { $html .= "<li>this page has no products of its own</li>"; } $html .= "</ul>"; return $html; }
public function debug() { $html = EcommerceTaskDebugCart::debug_object($this); $html .= "<ul>"; $html .= "<li><hr />Links<hr /></li>"; $html .= "<li><b>Link:</b> <a href=\"" . $this->Link() . "\">" . $this->Link() . "</a></li>"; $html .= "<li><b>Ajax Link:</b> <a href=\"" . $this->AjaxLink() . "\">" . $this->AjaxLink() . "</a></li>"; $html .= "<li><b>AddVariations Link:</b> <a href=\"" . $this->AddVariationsLink() . "\">" . $this->AddVariationsLink() . "</a></li>"; $html .= "<li><b>Add to Cart Link:</b> <a href=\"" . $this->AddLink() . "\">" . $this->AddLink() . "</a></li>"; $html .= "<li><b>Increment Link:</b> <a href=\"" . $this->IncrementLink() . "\">" . $this->IncrementLink() . "</a></li>"; $html .= "<li><b>Decrement Link:</b> <a href=\"" . $this->DecrementLink() . "\">" . $this->DecrementLink() . "</a></li>"; $html .= "<li><b>Remove Link:</b> <a href=\"" . $this->RemoveAllLink() . "\">" . $this->RemoveLink() . "</a></li>"; $html .= "<li><b>Remove All Link:</b> <a href=\"" . $this->RemoveAllLink() . "\">" . $this->RemoveAllLink() . "</a></li>"; $html .= "<li><b>Remove All and Edit Link:</b> <a href=\"" . $this->RemoveAllAndEditLink() . "\">" . $this->RemoveAllAndEditLink() . "</a></li>"; $html .= "<li><b>Set Specific Quantity Item Link (e.g. 77):</b> <a href=\"" . $this->SetSpecificQuantityItemLink(77) . "\">" . $this->SetSpecificQuantityItemLink(77) . "</a></li>"; $html .= "<li><hr />Cart<hr /></li>"; $html .= "<li><b>Allow Purchase (DB Value):</b> " . $this->AllowPurchaseNice() . " </li>"; $html .= "<li><b>Can Purchase (overal calculation):</b> " . ($this->canPurchase() ? "YES" : "NO") . " </li>"; $html .= "<li><b>Shop Open:</b> " . ($this->EcomConfig() ? $this->EcomConfig()->ShopClosed ? "NO" : "YES" : "NO CONFIG") . " </li>"; $html .= "<li><b>Extended Country Can Purchase:</b> " . ($this->extendedCan('canPurchaseByCountry', null) === null ? "no applicable" : ($this->extendedCan('canPurchaseByCountry', null) ? "CAN PURCHASE" : "CAN NOT PURCHASE")) . " </li>"; $html .= "<li><b>Allow sales to this country (" . EcommerceCountry::get_country() . "):</b> " . (EcommerceCountry::allow_sales() ? "YES" : "NO") . " </li>"; $html .= "<li><b>Class Name for OrderItem:</b> " . $this->classNameForOrderItem() . " </li>"; $html .= "<li><b>Quantity Decimals:</b> " . $this->QuantityDecimals() . " </li>"; $html .= "<li><b>Is In Cart:</b> " . ($this->IsInCart() ? "YES" : "NO") . " </li>"; $html .= "<li><b>Has Been Sold:</b> " . ($this->HasBeenSold() ? "YES" : "NO") . " </li>"; $html .= "<li><b>Calculated Price:</b> " . $this->CalculatedPrice() . " </li>"; $html .= "<li><b>Calculated Price as Money:</b> " . $this->getCalculatedPriceAsMoney()->Nice() . " </li>"; $html .= "<li><hr />Location<hr /></li>"; $html .= "<li><b>Main Parent Group:</b> " . $this->MainParentGroup()->Title . "</li>"; $html .= "<li><b>All Others Parent Groups:</b> " . ($this->AllParentGroups()->count() ? "<pre>" . print_r($this->AllParentGroups()->map()->toArray(), 1) . "</pre>" : "none") . "</li>"; $html .= "<li><hr />Image<hr /></li>"; $html .= "<li><b>Image:</b> " . ($this->BestAvailableImage() ? "<img src=" . $this->BestAvailableImage()->Link() . " />" : "no image") . " </li>"; $productGroup = ProductGroup::get()->byID($this->ParentID); if ($productGroup) { $html .= "<li><hr />Product Example<hr /></li>"; $html .= "<li><b>Product Group View:</b> <a href=\"" . $productGroup->Link() . "\">" . $productGroup->Title . "</a> </li>"; $html .= "<li><b>Product Group Debug:</b> <a href=\"" . $productGroup->Link("debug") . "\">" . $productGroup->Title . "</a> </li>"; $html .= "<li><b>Product Group Admin:</b> <a href=\"" . "/admin/pages/edit/show/" . $productGroup->ID . "\">" . $productGroup->Title . " Admin</a> </li>"; $html .= "<li><b>Edit this Product:</b> <a href=\"" . "/admin/pages/edit/show/" . $this->ID . "\">" . $this->Title . " Admin</a> </li>"; } $html .= "</ul>"; return $html; $html .= "</ul>"; return $html; }
public function debug() { $html = EcommerceTaskDebugCart::debug_object($this); $html .= "<ul>"; $html .= "<li><b>Buyable Price:</b> " . $this->Buyable()->Price . " </li>"; $html .= "<li><b>Buyable Calculated Price:</b> " . $this->Buyable()->CalculatedPrice() . " </li>"; $html .= "</ul>"; return $html; }