Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter buffyfan

    (@buffyfan)

    I tried this but it doesn’t work and stopped people being able to add anything to their basket.

    <?php
    // Scheduled Action Hook
    function updatedb( ) {
    $myfile = fopen("somefilename.csv", "r") or die("Unable to open file!");
    $csvArray = array_map('str_getcsv', file($myfile));
    global $wpdb;
    
    foreach($csvArray as $csvEntry) {
    $value = $csvEntry[2];
    $field = $csvEntry[1];
    $sku = $csvEntry[0];
    $wpdb->update(
            ppwp_postmeta,
            array(  meta_value = $value,
                   ),
            array(  meta_key = $field AND
                  post_id = (select post_id
                   from (select
                     meta_value,
                      post_id
                      from ppwp_postmeta
                      where meta_key = '_sku') as sku_post
                      where meta_value = $sku);
                   )
            );
    }
    
    fclose($myfile);
    }
    // Schedule Cron Job Event
    function update_stock_cron_job() {
    if ( ! wp_next_scheduled( ‘updatedb’ ) ) {
    wp_schedule_event( time(), ‘hourly’, ‘updatedb’ );
    }
    }
    add_action( ‘wp’, ‘update_stock_cron_job’ );
    ?> 

    Any help GREATLY appreciated.

    • This reply was modified 8 years, 8 months ago by buffyfan.
    Thread Starter buffyfan

    (@buffyfan)

    Thanks for the info @catacaustic
    I am able to update a CSV file, no problem, that will list stock levels.
    Then I need to set up a WordPress Cron job to read the CSV file every hour and update the database…unfortunately I’ve never written a cron job before. Can i define it in functions.php? If you have any advice on writing a cronjob for reading a CSV file and updating the database with it, i’d love to hear it as I haven’t worked with WordPress before!

    this is as far as I have gotten:

    // Scheduled Action Hook
    function updatedb( ) {
    }

    // Schedule Cron Job Event
    function update_stock_cron_job() {
    if ( ! wp_next_scheduled( ‘updatedb’ ) ) {
    wp_schedule_event( time(), ‘hourly’, ‘updatedb’ );
    }
    }
    add_action( ‘wp’, ‘update_stock_cron_job’ );

    • This reply was modified 8 years, 9 months ago by buffyfan.
    Thread Starter buffyfan

    (@buffyfan)

    Looks like I missed this from the Woocommerce site (hidden away)

    “Note: With Storefront you do not need enqueue any of the parent theme style files with PHP from the themes functions.php file or @import these into the child themes style.css file as the main parent Storefront theme does this for you.”

    I really dislike it when people stray from conventions.

    • This reply was modified 8 years, 9 months ago by buffyfan.
    Thread Starter buffyfan

    (@buffyfan)

    Error log: 07-28-2017 @ 16:56:01 – Apple Pay: Apple Pay not enabled or Stripe is not an available gateway ( Apple Pay button disabled )

    Apple pay IS enabled! Worst plugin ever!

    Thread Starter buffyfan

    (@buffyfan)

    Chrome pay is working when I press “proceed to checkout”, but unfortunately, so is something called Microsoft Wallet (on Microsoft Edge), which I really don’t think anyone will want to use. How can I disable it?

    I’m still not seeing anything Stripe-related on the Checkout page

    • This reply was modified 8 years, 9 months ago by buffyfan.
    Thread Starter buffyfan

    (@buffyfan)

    And I have fully verified my Stripe account, if that makes any difference.
    The theme is a child of Storefront, but only makes some CSS changes (no Javascript, little PHP) so it shouldn’t be affecting anything.

    Thread Starter buffyfan

    (@buffyfan)

    Hi @rafsuntaskin, thanks for your answer.
    How does logging in improve the experience? It is just an extra step before allowing somebody to actually pay their money. I’d really rather just remove it all together if you know a way how – I’ve removed it from my menu but don’t know how to remove it from the mobile footer.

    • This reply was modified 8 years, 9 months ago by buffyfan.
    • This reply was modified 8 years, 9 months ago by buffyfan.
Viewing 7 replies - 1 through 7 (of 7 total)