Skip to content

Instantly share code, notes, and snippets.

@tessguefen
tessguefen / minified.css.php
Last active October 5, 2015 22:17
Minify CSS
<?php
if (extension_loaded('zlib')) {
ob_start('ob_gzhandler');
}
header ('content-type: text/css; charset: UTF-8');
header ('cache-control: must-revalidate');
$offset = 60 * 60;
$expire = 'expires: ' . gmdate ('D, d M Y H:i:s', time() + $offset) . ' GMT';
header ($expire);
ob_start('compress');
@tessguefen
tessguefen / oopc-responsive.css
Created September 25, 2014 16:02
OOPC Responsive CSS (ish)
/* Fixes for OOPC to be responsive
IMPORTANT! make sure there is not a set width on the OOPC "container" */
@media (max-width: 979px) {
#opc_left {
width: 405px;
margin:0 auto;
display: block;
}
#opc_left div#customer-fields.opc-section {
width: 475px;
@tessguefen
tessguefen / miva_save-power-reviews-rating-to-custom-field.js
Created October 3, 2014 17:20
Miva Merchant - Save PowerReviews to a Custom Field (Thanks Steven!)
// Save PowerReviews rating amount and count to custom product field
$(window).load(function(){
var debug = false,
rating,
count,
productId = $('#product-id').text(),
timesChecked = 0,
storedRating = $('[itemprop="ratingValue"]').text(),
storedCount = $('[itemprop="reviewCount"]').text();
@tessguefen
tessguefen / yotpo-reviews-to-custom-field.js
Last active August 29, 2015 14:07
Yotpo Ratings to Custom Field (Edited from Steven's)
// -- Save Yotpo Reviews to Custom Field -- //
$(window).load(function(){
var debug = false,
rating,
count,
productCode = $('#product-code').text(),
timesChecked = 0,
storedRating = $('[itemprop="average"]').text(),
storedCount = $('[itemprop="votes"]').text();
@tessguefen
tessguefen / magento-categories
Last active August 29, 2015 14:07
Magento -- Categories
//Check for 111 and 149 to make sure it's correct.
SELECT DISTINCT cc.entity_id as id, cc.value as path, cc1.value as name
FROM catalog_category_entity_varchar cc
JOIN catalog_category_entity_varchar cc1 ON cc.entity_id=cc1.entity_id
JOIN eav_entity_type ee ON cc.entity_type_id=ee.entity_type_id
JOIN catalog_category_entity cce ON cc.entity_id=cce.entity_id
WHERE cc.attribute_id = '111' AND cc1.attribute_id = '479' AND ee.entity_model = 'catalog/category';
@tessguefen
tessguefen / magento-products-by-category.sql
Last active August 29, 2015 14:07
Magento Products by Category
SELECT p.entity_id AS prod,
prod_varchar.value,
p.sku AS sku,
cp.category_id AS cp_category_id,
cp.`position` AS cp_position,
c.`entity_id` AS c_category_id,
cat_varchar.value AS CatName,
c.`entity_type_id` AS c_entity_type_id,
c.`attribute_set_id` AS c_attribute_set_id,
c.`parent_id` AS c_parent_id,
@tessguefen
tessguefen / sebenza-reviews-with-schema.xml
Last active August 29, 2015 14:07
Sebenza Reviews with Schema
<div id="review-average">
<mvt:if expr="g.Total_Reviews">
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue" content="&mvt:productrating:rating;" />
Average Review for <strong>&mvt:product:name;</strong><br />
<span class="review-stars">&mvt:productrating:stars;</span> | <span itemprop="reviewCount">&mvt:global:Total_Reviews;</span> Reviews<br />
<a href="&mvt:global:sessionurl;Screen=WREVIEWS&Product_Code=&mvt:global:product_code;&Store_Code=&mvt:global:Store_Code;">Write an online review</a> and share your thoughts with others.<br />
</div>
<mvt:else>
&mvt:product:name; has not been rated yet. <a href="&mvt:global:sessionurl;Screen=WREVIEWS&Product_Code=&mvt:global:product_code;&Store_Code=&mvt:global:Store_Code;">Write an online review</a> and share your thoughts with others.<br />
@tessguefen
tessguefen / colorbox-additional-images-and-titles.js
Last active August 29, 2015 14:07
Colorbox pop up, with titles and additional images -- Example
<mvt:item name="customfields" param="Read_Product_Code( l.settings:product:code, 'main_img_title, add_title1, add_title2, add_title3, add_title4, add_title5', l.settings:customfields )" />
ImageMachine.prototype.ImageMachine_Generate_Thumbnail = function( thumbnail_image, main_image, closeup_image, type_code )
{
var thumbnail, span, img, atag;
thumbnail = document.createElement( 'li' );
span = document.createElement( 'span' ); // to vertically center the thumbnail images
atag = document.createElement( 'a' );
@tessguefen
tessguefen / external-zoom.js
Last active August 29, 2015 14:07
External Zoom Image Machine
== Custom.js ==
$('#thumbnails img').on('click', function() {
$('a.zoom').attr('href', $(this).attr('data-large'));
$('a.zoom').easyZoom({
preload: '<p class="preloader">Loading the image</p>',
parent: '.product-main'
});;
});
$('a.zoom').easyZoom({
preload: '<p class="preloader">Loading the image</p>',
@tessguefen
tessguefen / redirects-with-parameters
Last active August 29, 2015 14:07
redirects for miva with parameters
RewriteCond %{QUERY_STRING} Category_Code=31
RewriteRule (.*) /outdoor-designs.html? [R=301]
Redirect 301 /31.html /outdoor-designs.html?