@plan Blade Directive For Laravel Spark
Works with user & team billing
Add this to the boot() method of your AppServiceProvider
\Blade::directive('plan', function($plans) {
$model = auth()->user();| <?php | |
| /** | |
| * Prevent taxonomy-based attributes from being overwritten when a Product Set | |
| * updates a product already in your store. | |
| * | |
| * @see wc_get_product_terms() | |
| * @link http://stackoverflow.com/a/13454788/2489248 | |
| * | |
| * @param array|string $value The current value of the $attribute for this $post. |
| <?php | |
| /** | |
| * Add the custom attribute label "Special Promotion" to a product. | |
| * | |
| * @param array $attributes An array attributes. | |
| * @param array $post An array of post data including ID, post_title, post_status, etc... | |
| * @param array $product An array of product data returned from the Datafeedr API. | |
| * @param array $set A post array for this Product Set with an array key of postmeta containing all post meta data. | |
| * @param string $action The action the Product Set is performing. Value are either "insert" or "update". |
| <?php | |
| /** | |
| * Replace affiliate links with links to VigLink. | |
| * | |
| * There are limitations to this method. Not all products contain the necessary data | |
| * to redirect to VigLink. If the necessary data is not available, the affiliate network | |
| * affiliate link will be returned instead. Therefore it's a good idea to enter your | |
| * affiliate ID for all networks just in case here WordPress Admin Area >Datafeedr API > Networks | |
| * |
| <?php | |
| /** | |
| * Display the Savings discount for a product that's on sale on product list pages. | |
| */ | |
| add_action( 'woocommerce_after_shop_loop_item', 'mycode_show_discount_in_product_lists' ); | |
| function mycode_show_discount_in_product_lists() { | |
| global $product; | |
| $salediscount = get_post_meta( $product->id, '_dfrps_salediscount', true ); | |
| if ( $salediscount > 0 ) { |
| <?php | |
| /** | |
| * Add "Sort by discount" to sorting options. Defaults to biggest to smallest discount. | |
| */ | |
| add_filter( 'woocommerce_get_catalog_ordering_args', 'mycode_woocommerce_add_salediscount_to_catalog_ordering_args' ); | |
| function mycode_woocommerce_add_salediscount_to_catalog_ordering_args( $args ) { | |
| $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); | |
| if ( 'discount' == $orderby_value ) { | |
| $args['orderby'] = 'meta_value_num'; |
| <?php | |
| /** | |
| * This modifies the affiliate link and redirects the link back to the site's | |
| * homepage with specific query parameters added. | |
| */ | |
| add_filter( 'dfrapi_after_affiliate_id_insertion', 'mycode_redirect_to_exit_page', 20, 3 ); | |
| function mycode_redirect_to_exit_page( $url, $product, $affiliate_id ) { | |
| $args = array( |
| <?php | |
| /** | |
| * Prevent product titles, descriptions & excerpts from being overwritten during Product Set updates. | |
| * | |
| * @param array $post Array containing WordPress Post information. | |
| * @param array $product Array containing Datafeedr Product information. | |
| * @param array $set Array containing Product Set information. | |
| * @param string $action Either "update" or "insert" depending on what the Product Set is doing. | |
| * |
@plan Blade Directive For Laravel SparkWorks with user & team billing
Add this to the boot() method of your AppServiceProvider
\Blade::directive('plan', function($plans) {
$model = auth()->user();Open the Terminal app on Mac.
Change directories so that you are in your user's .ssh directory. For example, my user directory is named "Eric" so I would type the following into Terminal:
cd /Users/Eric/.ssh
Now you need to generate your SSH key pairs. Enter the following command into Terminal (source 1, source 2):
ssh-keygen -t rsa -b 4096 -C "[email protected]"
| <?php | |
| /** | |
| * Add the product's color as a color attribute for this product. | |
| * | |
| * The attribute "Color" with a slug of "color" must already exist here: | |
| * WordPress Admin Area > Products > Attributes. | |
| * | |
| * @param array|string $value The current value of the $attribute for this $post. | |
| * @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size |