Skip to content

Instantly share code, notes, and snippets.

View prinzdezibel's full-sized avatar

Michael Jenny prinzdezibel

  • Bahlingen, Germany
View GitHub Profile
import { replaceComponent, getHOCs, composeWithTracker } from "@reactioncommerce/reaction-components";
import ProductsComponent from "../../components/product-variant/products";
/*
* Customized version of imports/plugins/included/product-variant/containers/productsContainer.js
* It subscribes to featured products only for landing page section "Products we love"
*/
function composer(props, onData) {
window.prerenderReady = false;
import { getSchemas } from "@reactioncommerce/reaction-collections";
// Validate the subscription filter against our extended filter schema.
const Schemas = getSchemas();
const filters = Schemas.filters;
/* Replace stock publication with our custom publication that knows how to filter
* featured products as well.
*/
methods.importProductImages = function () {
Logger.info("Started loading product images");
if (!checkForMedia()) {
const products = Products.find({ type: "simple" }).fetch();
for (const product of products) {
const productId = product._id;
if (!Media.findOne({ "metadata.productId": productId })) {
const shopId = product.shopId;
const filepath = `plugins/reaction-swag-shop/images/${productId}.jpg`;
const binary = Assets.getBinary(filepath);
Hooks.Events.add("beforeCoreInit", () => {
methods.loadShops();
Logger.info("Finished loading Shop data");
});
Hooks.Events.add("afterCoreInit", () => {
methods.initLayout();
methods.loadProducts();
methods.loadTags();
methods.loadShipping();
methods.loadShops = function () {
Logger.info("Starting load Shops");
if (!checkForShops()) {
const shops = require("../private/data/Shops.json");
shops.forEach((shop) => {
Shops.insert(shop);
Logger.info(`Inserted shop: ${shop.name}`);
});
Logger.info("Shops loaded");
}
import React from "react";
import { replaceComponent } from "@reactioncommerce/reaction-components";
import ProductGridItemsCore from "/imports/plugins/included/product-variant/components/productGridItems";
class ProductGridItems extends ProductGridItemsCore {
static labelColorPalette = [
"#2899D3", // blue
"#40e0d0", // turquoise
"#F2542F" // orange
import React from "react";
import { Components } from "@reactioncommerce/reaction-components";
import { default as CoreProductAdmin } from "/imports/plugins/included/product-admin/client/components/productAdmin";
import { replaceComponent } from "@reactioncommerce/reaction-components";
class ProductAdmin extends CoreProductAdmin {
render() {
return (
// -------------- %< --------------------
import { SimpleSchema } from "meteor/aldeed:simple-schema";
import { Product } from "/lib/collections/schemas/index";
import { Products } from "/lib/collections/index";
import { getSchemas, registerSchema } from "@reactioncommerce/reaction-collections";
const ExtendedSchema = new SimpleSchema([
Product,
{
featuredProductLabel: {
const oauth = Npm.require('oauth');
const Agenda = Npm.require('agenda');
Meteor.startup(function(){
const mongoURL = process.env.MONGO_URL;
var agenda = new Agenda({db: {address: mongoURL}});
agenda.define('sync_inventory', Meteor.bindEnvironment(function(job, done) {
try {
syncInventory();