I like to get all available checkout fields, including third party ones: returns a fatal error: Is there an offical way to get them? Edit: My plugin needs a dropdown field with all available checkout fields on the backend. What I like to have is an array like this (I var_dump the $checkout_fields variable of …
Tag: php
Dependency injection on dynamically created objects
I’m using reflection to test if a class has a particular parent class and then returning an instance of it. I want to be able to unit test these instantiated objects but I don’t know if there is any way to use dependency injection in this case. My thought was to use factories to get dependencies. …
SwiftMailer silently ignores errors when messages fail delivery
When run from inside controller and when in-memory spooling is configured via spool: { type: memory } swiftmailer seems to work like this: whenever from within controller mailer->send($message) …
Laravel blade multiple select. How to select records in the pivot table?
I am using Laravel, and I have a projects table and a users table. Each project can have multiple users. I have set up a project_user pivot table. I am trying to create a multiselect box that lists all users, and has the users currently assigned to the project selected. Here is my ProjectsController function …
PHP check if time falls within range, questioning common solution
I have to check if the current daytime falls in a specific range. I looked up the internet and found several similar solutions like this one: If both conditions have to be true, how can this bis achieved when we assume that $start is 06:00:00 and $end is 02:00:00. If we make the assumption that it is 01:00:00…
Hide ‘add to cart’ button ONLY on woocommerce shop/category pages
I want to hide the button on my shop pages, but I would like to show it on other posts and pages. I’ve found this code to hide the add to cart button on my whole website: add_action( ‘…
How to insert data using CI active record to field names with space?
How to insert data to the fields with name containing space. eg : Insert batch is also not working. Answer Check the following code. Which worked for me. use $db->set method
Yii – findAll with order by
How to findAll with specific column with order by desc ? Code bellow worked and find all from the developer id $id = Yii::app()->user->getState(‘id’); $models = Games::model()->findAll(‘…
WooCommerce: function that returns all product ID’s in a particular category
I think the title of the question is fairly self-explanatory, but to detail it… I’m trying to make a custom category page in Woocommerce. What I need is to return all the product ID’s in a particular category. I’ve seen this post, but it uses the WP_Query way of doing things, which is …
assigning variables to sql query result
Amateur here, just practicing some sql. I am trying to assign php variables to my sql query results, and I thought I saw it work in this fashion, but it doesn’t seem to be working for me: $query1 = …