Skip to content

Commit

Permalink
fixed initial errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Anderson committed Oct 10, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent c27df4a commit efdbc8d
Showing 13 changed files with 32 additions and 29 deletions.
9 changes: 0 additions & 9 deletions _config.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
<?php

// add the extension to pages
if (class_exists('SiteTree')) {
SiteTree::add_extension('GoogleSitemapSiteTreeExtension');
}

// if you need to add this to DataObjects include the following in
// your own _config:

// GoogleSiteMap::register_dataobject('MyDataObject');
8 changes: 0 additions & 8 deletions _config/googlesitemaps.yml

This file was deleted.

17 changes: 17 additions & 0 deletions _config/shoppingfeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
Name: googleshoppingfeed
---
ilateral\SilverStripe\GoogleShoppingFeed\GoogleShoppingFeed:
enabled: true
google_notification_enabled: false
use_show_in_search: true
use_disabled: false
---
Only:
moduleexists: 'silvercommerce/catalogue-admin'
After: '#catalogueconfig'
---
SilverCommerce\CatalogueAdmin\Model\CatalogueProduct:
extensions:
ilateral\SilverStripe\GoogleShoppingFeed\extensions\Extension

File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion src/.upgrade.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mappings:
GoogleShoppingFeedExtension: ilateral\SilverStripe\GoogleShoppingFeed\extensions\GoogleShoppingFeedExtension
GoogleShoppingFeedExtension: ilateral\SilverStripe\GoogleShoppingFeed\extensions\Extension
GoogleProductCategory: ilateral\SilverStripe\GoogleShoppingFeed\model\GoogleProductCategory
GoogleShoppingFeed: ilateral\SilverStripe\GoogleShoppingFeed\GoogleShoppingFeed
GoogleShoppingFeedController: ilateral\SilverStripe\GoogleShoppingFeed\controllers\GoogleShoppingFeedController
9 changes: 3 additions & 6 deletions src/controllers/GoogleShoppingFeedController.php
Original file line number Diff line number Diff line change
@@ -2,17 +2,14 @@

namespace ilateral\SilverStripe\GoogleShoppingFeed\controllers;

use Zend_Currency;
use NumberFormatter;
use SilverStripe\i18n\i18n;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Config\Config;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\SiteConfig\SiteConfig;
use ilateral\SilverStripe\GoogleShoppingFeed\GoogleShoppingFeed;


require_once BASE_PATH . "/" . THIRDPARTY_DIR . "/Zend/Currency.php";

/**
* Controller for displaying the xml feed.
*
@@ -54,14 +51,14 @@ public function index()

$items = GoogleShoppingFeed::get_items();

$currency = new Zend_Currency(i18n::get_locale());
$currency = new NumberFormatter(i18n::get_locale(), NumberFormatter::CURRENCY);

$this->extend('updateGoogleShoppingFeedItems', $items);

return array(
"SiteConfig" => SiteConfig::current_site_config(),
'Items' => $items,
"Currency" => $currency->getShortName()
"Currency" => $currency->getTextAttribute(NumberFormatter::CURRENCY_CODE)
);
} else {
return new SS_HTTPResponse(_t("GoogleShoppingFeed.PageNotFound", 'Page not found'), 404);
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
use TractorCow\AutoComplete\AutoCompleteField;


class GoogleShoppingFeedExtension extends DataExtension
class Extension extends DataExtension
{

/**
@@ -202,11 +202,13 @@ public function hasCMSSettingsFields()
*/
public function updateSettingsFields(FieldList $fields)
{
if($this->hasCMSSettingsFields()) {
var_dump("i'm here!");
exit;
if($this->owner->hasCMSSettingsFields()) {
$tabset = $fields->findOrMakeTab('Root.Settings');

if ($tabset) {
$this->addCMSFieldsToTabset($tabset);
$this->owner->addCMSFieldsToTabset($tabset);
}
}
}
@@ -219,11 +221,13 @@ public function updateSettingsFields(FieldList $fields)
*/
public function updateCMSFields(FieldList $fields)
{
if (!$this->hasCMSSettingsFields()) {
var_dump("i'm here!");
exit;
if (!$this->owner->hasCMSSettingsFields()) {
$tabset = $fields->findOrMakeTab('Root.Settings');

if ($tabset) {
$this->addCMSFieldsToTabset($tabset);
$this->owner->addCMSFieldsToTabset($tabset);
}
}
}
2 changes: 2 additions & 0 deletions src/model/GoogleProductCategory.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@

class GoogleProductCategory extends DataObject
{
private static $table_name = "GoogleProductCetegory";

private static $db = [
"GoogleID" => "Int",
"Title" => "Varchar(255)"

0 comments on commit efdbc8d

Please sign in to comment.