Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lwojciechowski committed Aug 14, 2015
1 parent cb194e0 commit b984412
Show file tree
Hide file tree
Showing 27 changed files with 93,650 additions and 0 deletions.
6,171 changes: 6,171 additions & 0 deletions assets/categories/cs-CZ.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/da-DK.txt

Large diffs are not rendered by default.

6,169 changes: 6,169 additions & 0 deletions assets/categories/de-DE.txt

Large diffs are not rendered by default.

6,217 changes: 6,217 additions & 0 deletions assets/categories/en-US.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/es-ES.txt

Large diffs are not rendered by default.

6,170 changes: 6,170 additions & 0 deletions assets/categories/fr-FR.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/it-IT.txt

Large diffs are not rendered by default.

6,179 changes: 6,179 additions & 0 deletions assets/categories/ja-JP.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/nl-NL.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/no-NO.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/pl-PL.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/pt-BR.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/ru-RU.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/sv-SE.txt

Large diffs are not rendered by default.

6,171 changes: 6,171 additions & 0 deletions assets/categories/tr-TR.txt

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions assets/google-feed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8' ?>
<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:g='http://base.google.com/ns/1.0'>
<channel>
<title><![CDATA[<?php echo $title ?>]]></title>
<link><?php echo $link ?></link>
<description><![CDATA[<?php echo $description ?>]]></description>

<?php echo $items ?>

</channel>
</rss>
17 changes: 17 additions & 0 deletions assets/google-item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<item>
<g:id><?php echo $id ?></g:id>
<title><![CDATA[<?php echo $title ?>]]></title>
<description><![CDATA[<?php echo $description ?>]]></description>
<link><?php echo $link ?></link>
<g:image_link><?php echo $image_link ?></g:image_link>
<g:condition><?php echo $condition ?></g:condition>
<g:availability><?php echo $availability ?></g:availability>
<g:price><?php echo $price ?></g:price>
<g:google_product_category><?php echo $category ?></g:google_product_category>
<g:product_type><?php echo $product_type ?></g:product_type>
<g:gtin><?php echo $gtin ?></g:gtin>
<g:mpn><?php echo $mpn ?></g:mpn>
<g:brand><?php echo $brand ?></g:brand>
<g:shipping_weight><?php echo $weight ?></g:shipping_weight>
<g:identifier_exists><?php echo $identifier_exists; ?></g:identifier_exists>
</item>
28 changes: 28 additions & 0 deletions assets/templates/category-meta-box.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<tr>
<th colspan="2">
<h3 style="margin-bottom: 0;"><?php _e('Google Product Feed', 'chucky-google-product-feed'); ?></h3>
<p class="description"><?php _e('Those setting will override global default options', 'chucky-google-product-feed'); ?></p>
<input type="hidden" name="chucky_settings" value="1" />
</th>
</tr>


<tr class="form-field">
<th scope="row"><label for="chucky_category"><?php _e('Product category', 'chucky-google-product-feed'); ?></label></th>
<td>
<select name="chucky_category" id="chucky_category">
<?php foreach($google_categories as $k => $v): ?>
<option <?php if($k == $settings['category']) echo 'selected'; ?> value="<?php echo $k; ?>"><?php echo $v; ?></option>
<?php endforeach; ?>
</select>

<p class="description"><?php echo sprintf(__('Default google category for items in %s category', 'chucky-google-product-feed'), $category->name); ?></p>
</td>
</tr>
<tr class="form-field">
<th scope="row"><label for="chucky_brand"><?php _e('Brand', 'chucky-google-product-feed'); ?></label></th>
<td>
<input type="text" name="chucky_brand" id="chucky_brand" size="20" value="<?php echo isset($settings['brand']) ? $settings['brand'] : ''; ?>"/>
<p class="description"><?php echo sprintf(__('Default brand for items in %s category', 'chucky-google-product-feed'), $category->name); ?></p>
</td>
</tr>
44 changes: 44 additions & 0 deletions assets/templates/product-meta-box.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<p>
<label for="chucky-identifier-exists"><?php _e('Identifier does not exist', 'chucky-google-product-feed'); ?></label>
<input id="chucky-identifier-exists" type="checkbox" name="chucky-identifier-exists" value="1" <?php echo isset($settings['identifier']) && $settings['identifier'] == 'unexist' ? 'checked' : ''; ?>/> <br />
<small><?php _e('Check this field if the item does not have unique product identifier, such as GTIN, MPN or brand.', 'chucky-google-product-feed'); ?></small>
</p>

<div id="chucky-upi">
<p>
<label for="chucky-gtin"><?php _e('Product GTIN', 'chucky-google-product-feed'); ?></label> - <small><?php _e('Global Trade Item Numbers (GTIN) include <strong>UPC</strong>, <strong>EAN</strong> (in Europe), <strong>JAN</strong> and <strong>ISBN</strong>', 'chucky-google-product-feed'); ?></small><br />
<input type="text" name="chucky_gtin" id="chucky-gtin" value="<?php echo isset($settings['gtin']) ? $settings['gtin'] : ''; ?>" placeholder="<?php _e('GTIN', 'chucky-google-product-feed'); ?>" />
</p>

<p>
<label for="chucky-mpn"><?php _e('Product MPN', 'chucky-google-product-feed'); ?></label> - <small><?php _e('Manufacturer Part Number', 'chucky-google-product-feed'); ?></small><br />
<input type="text" name="chucky_mpn" id="chucky-mpn" value="<?php echo isset($settings['mpn']) ? $settings['mpn'] : ''; ?>" placeholder="<?php _e('MPN', 'chucky-google-product-feed'); ?>" />
</p>

<p>
<label for="chucky-brand"><?php _e('Product brand', 'chucky-google-product-feed'); ?></label><br />
<input type="text" name="chucky_brand" id="chucky-brand" value="<?php echo isset($settings['brand']) ? $settings['brand'] : ''; ?>" placeholder="<?php _e('Brand', 'chucky-google-product-feed'); ?>" />
</p>
</div>
<p>
<label for="chucky-category"><?php _e('Product Category', 'chucky-google-product-feed'); ?></label><br />
<select name="chucky_category" id="chucky-category">
<option value="0">Use default</option>
<?php foreach($google_categories as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php if(isset($settings['category']) && $v == $settings['category']){ echo 'selected'; }; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</p>

<input type="hidden" name="chucky_settings" value="1" />

<script type="text/javascript" >
jQuery('document').ready(function () {

jQuery('#chucky-identifier-exists').click(function () {
jQuery('#chucky-upi').toggle(!this.checked);
})

jQuery('#chucky-upi').toggle(!jQuery('#chucky-identifier-exists').is(':checked'));
});
</script>
42 changes: 42 additions & 0 deletions google-product-feed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* I am Chucky, the killer doll! And I dig it!
*/
namespace Chucky;

/*
Plugin Name: Google Product Feed for WooCommerce
Plugin URI: https://github.com/nostrzak/google-product-feed
Description: Google Product Feed for Google Merchants integration
Version: 1.0.0
Author: Łukasz Wojciechowski
Author URI: https://github.com/nostrzak
License: GPL2
*/

if (!defined('ABSPATH')) exit;

define('Chucky\__ASSETS__', __DIR__ . '/assets');
define('Chucky\__BASEFILE__', __FILE__);

// Autoloader
require_once __DIR__ . '/src/Chucky/Tool/ClassLoader.php';

$loader = new Tool\ClassLoader();
$loader->addPrefix('Chucky', __DIR__ . '/src');
$loader->register();

// Check if WooCommerce is active
if (in_array('woocommerce/woocommerce.php', get_option('active_plugins'))) {

// Admin
if(is_admin()) {
$admin = new Controller\Admin();
$admin->run();
}

// Feed
$feed = new Controller\Feed();
$feed->run();
}
Loading

0 comments on commit b984412

Please sign in to comment.