-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
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> |
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> |
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> |
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> |
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(); | ||
} |